[GEM-dev] Pd crashing when closing Gem window with

IOhannes m zmoelnig zmoelnig at iem.at
Tue Jun 27 11:32:27 CEST 2006


Frank Barknecht wrote:
> Hi, 
> 
> I want to close the GEM window using a key read with [gemkeyname]
> however this crashes Pd. Using attached little patch, I get the
> following GDB backtrace: 
[...]
> Clicking the destroy-message box by hand doesn't crash. Any ideas?
> 

this used to be "just normal".
image what happens: you press a key; [gemkeyname] binds itself to the 
window and reads all events that occured since the last time; a message 
is sent to the outlet; the gemkeyname-function is pushed to the stack; 
the message triggers window destruction; window is destroyed and 
invalid; the gemkeyname-function is popped from the stack and continues 
to run with a now invalid window -> references to this window crash pd.

when you click on the [destroy( message manually, then the function 
stack is clean.

2 ways to fix it: decouple the gemkeyname-message from the [destroy( 
message by a simple [del 0]
in current CVS this should be fixed (but i often find that i think i 
have checked in changes and actually have not....)


mfg,.adr.
IOhannes

PS: i noticed a very similar thing with plain pd just recently: if you 
have an object which emits a message which is then sent out of the 
canvas (abstraction, subpatch) and which is used to clear the canvas 
immediately (destroying the object), this crashes pd.
decoupling the message sending from the object destruction saves your live.
however, i am not sure, whether this *should* be fixed: it is more a bug 
in the patch than within pd itself.







More information about the GEM-dev mailing list