Page 1 of 1
Canvas #PB_EventType_Destroy
Posted: Sun Sep 29, 2024 8:46 am
by Justin
It would be possible to have a binded event that gets called just before the canvas is destroyed as a last event?
Often you have to set some memory using SetGadgetData() that needs to be freed when the gadget is destroyed.
Doing it manually is not reliable when the gadget is not explicitly freed by you.
Re: Canvas #PB_EventType_Destroy
Posted: Sun Sep 29, 2024 9:22 am
by Bisonte
On Windows you can make it with a Callback... Like
AddEvents
Re: Canvas #PB_EventType_Destroy
Posted: Sun Sep 29, 2024 4:48 pm
by Justin
Thanks, I know it can be done with the api, windows and linux are easy, mac more difficult although it can be done, a native solution is needed.
Re: Canvas #PB_EventType_Destroy
Posted: Sun Sep 29, 2024 4:59 pm
by Fred
I agree it could useful when using custom data. Probably for all gadgets as well.
Re: Canvas #PB_EventType_Destroy
Posted: Sun Sep 29, 2024 10:00 pm
by Justin
Great, hopefully in the next version
Re: Canvas #PB_EventType_Destroy
Posted: Tue Oct 01, 2024 5:39 pm
by mk-soft
Perhaps better a SetFreeGadgetCallback

Re: Canvas #PB_EventType_Destroy
Posted: Tue Oct 01, 2024 6:46 pm
by Justin
Yes that sounds better, my attemp fails in some apple systems
Re: Canvas #PB_EventType_Destroy
Posted: Tue Oct 01, 2024 8:06 pm
by SPH
Fred wrote: Sun Sep 29, 2024 4:59 pm
I agree it could useful when using custom data. Probably for all gadgets as well.
❤