Raised This Month: $32 Target: $400
 8% 

pass handle through timer


Post New Thread Reply   
 
Thread Tools Display Modes
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-31-2018 , 10:37   Re: pass handle through timer
Reply With Quote #11

Cheking trough sm_dump_handles, TIMER_DATA_HNDL_CLOSE will close created Events.
Without TIMER_DATA_HNDL_CLOSE Handles are begin stack

*edit
Read post below. Must Cancel created Event

Last edited by Bacardi; 12-31-2018 at 18:00.
Bacardi is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 12-31-2018 , 17:21   Re: pass handle through timer
Reply With Quote #12

The CreateEvent docs say not to just close the handle. I didn't look at the implementation to see why, but it may leak memory with the handle being closed.
Fyren is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-31-2018 , 17:33   Re: pass handle through timer
Reply With Quote #13

Quote:
Originally Posted by Fyren View Post
The CreateEvent docs say not to just close the handle. I didn't look at the implementation to see why, but it may leak memory with the handle being closed.
Both FireEvent / event.Fire and CancelCreatedEvent / event.Cancel will close the event handle when they finish.

In fact, you have to call one of these two methods if you've called CreateEvent or else the event handle will leak. You can't close event handles yourself because they're owned by the SourceMod core and not your plugin.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 12-31-2018 at 17:35.
Powerlord is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-01-2019 , 04:42   Re: pass handle through timer
Reply With Quote #14

Quote:
Originally Posted by 1337norway View Post
This is actually a really good idea. You can pass data with custom names you give and use the native binary write system the source engine utilizes. Since sourcemod isn't freaking out about non existing event parameters and you aren't firing the event that would clog up the event system, I don't see any issue with using that. Assuming the TIMER_DATA_HNDL_CLOSE parameter is actually freeing the memory. I like it because you can define a string that represents an array index like in python.
I think Close handle is forbidden for events. Only cancel and fire.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode