Hi,
Can anyone help me understand why an external's free function doesn't seem to be called if pd is shut down as a whole (ex. ctrl-q)? I put post's, printf's, and breakpoints in my free function and they are called if I remove the external from the patch or the patch as a whole (ex. ctrl-w). But, if I shut down pd all at once, the breakpoint doesn't trigger and I don't get any print. The same thing happens in a flext external, within the ~Destructor method. I don't understand.
Regards, Rich
On Sat, 28 Nov 2009, Rich E wrote:
Can anyone help me understand why an external's free function doesn't seem to be called if pd is shut down as a whole (ex. ctrl-q)? I put post's, printf's, and breakpoints in my free function and they are called if I remove the external from the patch or the patch as a whole (ex. ctrl-w). But, if I shut down pd all at once, the breakpoint doesn't trigger and I don't get any print. The same thing happens in a flext external, within the ~Destructor method. I don't understand.
because the exit() function always skips over all destructions except those mandated by atexit().
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
Okay, so Ctrl-Q skips all free functions on purpose. If I am understanding correctly, I need to register my cleanup function with atexit on a function of type void _function_(void), but that means I don't have access to any of my object's member variables.
In the case of flext, the external class would need to be declared as static in order for its destructor to be called before shutting down - do you know if this is right, or possible, Thomas or anyone else knowing about flext/C++ and pd?
The reason I need this is because I am messing around with disconnecting the wacom events from controlling the tablet, which takes some calls that change the driver's settings. If I cannot turn the settings back before the program stops, they are permanently screwed until I restart the driver/computer. At least, this is all I can tell so far.
Rich
On Sun, Nov 29, 2009 at 3:05 AM, Mathieu Bouchard matju@artengine.cawrote:
On Sat, 28 Nov 2009, Rich E wrote:
Can anyone help me understand why an external's free function doesn't seem
to be called if pd is shut down as a whole (ex. ctrl-q)? I put post's, printf's, and breakpoints in my free function and they are called if I remove the external from the patch or the patch as a whole (ex. ctrl-w). But, if I shut down pd all at once, the breakpoint doesn't trigger and I don't get any print. The same thing happens in a flext external, within the ~Destructor method. I don't understand.
because the exit() function always skips over all destructions except those mandated by atexit().
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
On Tue, 1 Dec 2009, Rich E wrote:
Okay, so Ctrl-Q skips all free functions on purpose. If I am understanding correctly, I need to register my cleanup function with atexit on a function of type void _function_(void), but that means I don't have access to any of my object's member variables.
one workaround is to make a global map<MyClass,int> where int is a dummy (unfortunately, void is not accepted as an argument of that type-pattern).
In the case of flext, the external class would need to be declared as static in order for its destructor to be called before shutting down - do you know if this is right, or possible, Thomas or anyone else knowing about flext/C++ and pd?
This doesn't sound right. Note that there are some things that apply to objects that are directly global, and don't apply when the global variables are just pointers. I almost always use the latter because the former is a pain in the ass. (any static variable counts as global in this case, because they're essentially a kind of hidden global).
The reason I need this is because I am messing around with disconnecting the wacom events from controlling the tablet, which takes some calls that change the driver's settings. If I cannot turn the settings back before the program stops, they are permanently screwed until I restart the driver/computer. At least, this is all I can tell so far.
ow. so what can it do in case of segmentation fault or other crash of Pd?... what happens if you bang a naked [until] while you use your wacom thing?
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
You have a point, pd crashing some time or another is inevitable, and even 'force quitting' the example app given to me by a the Wacom guys has the same problem as I am dealing with - with one difference in that restarting their app will reset the driver to its original state. I must still be missing something in my attempts.
One thing I still wonder about; why is shutting pd via Ctrl-q any different than closing a patch (causing an exit() before destroying the patches)? [closebang]'s won't work either, I suppose, among other things like what I am trying to do.
On Sat, Dec 5, 2009 at 4:26 AM, Mathieu Bouchard matju@artengine.ca wrote:
On Tue, 1 Dec 2009, Rich E wrote:
Okay, so Ctrl-Q skips all free functions on purpose. If I am
understanding correctly, I need to register my cleanup function with atexit on a function of type void _function_(void), but that means I don't have access to any of my object's member variables.
one workaround is to make a global map<MyClass,int> where int is a dummy (unfortunately, void is not accepted as an argument of that type-pattern).
In the case of flext, the external class would need to be declared as
static in order for its destructor to be called before shutting down - do you know if this is right, or possible, Thomas or anyone else knowing about flext/C++ and pd?
This doesn't sound right. Note that there are some things that apply to objects that are directly global, and don't apply when the global variables are just pointers. I almost always use the latter because the former is a pain in the ass. (any static variable counts as global in this case, because they're essentially a kind of hidden global).
The reason I need this is because I am messing around with disconnecting
the wacom events from controlling the tablet, which takes some calls that change the driver's settings. If I cannot turn the settings back before the program stops, they are permanently screwed until I restart the driver/computer. At least, this is all I can tell so far.
ow. so what can it do in case of segmentation fault or other crash of Pd?... what happens if you bang a naked [until] while you use your wacom thing?
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801