develooper Front page | perl.perl5.porters | Postings from November 2003

Re: need your help to do some (simple?) patching

Thread Previous | Thread Next
Jan Dubois
November 17, 2003 08:46
Re: need your help to do some (simple?) patching
Message ID:
On Mon, 17 Nov 2003 11:02:49 +0000, Nick Ing-Simmons
<> wrote:

>>I recognize that this is Windows specific, but at least on Windows it is
>>not safe to call PERL_GET_CONTEXT from a Window callback.  
>Which is why I don't claim even Tk804 to be thread ready yet.

This is unrelated to threading.  I've seen crashes (of Win32::GUI, not Tk)
in a singled threaded application, embedding just a single Perl
interpreter.  The sequence of events was:

* App sets context, calls into Perl
* Perl code creates dialog
* User terminates dialog
* Perl returns to App
* App restores context (to NULL, as there is no other interpreter)
* Windows dispatches another message (WM_SETFOCUS) to the dialog
* Dialog does PERL_GET_CONTEXT, sets context, calls into Perl and crashes

A workaround here was to globally set the context once the Perl
interpreter was created.  But the real bug was Win32::GUI calling
PERL_GET_CONTEXT in a window procedure.  If the App had been switching
between multiple interpreters, this workaround would not have been
I don't know if this scenario is possible with Tk too; I just wanted to
alert you that it is a potential source of problems.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About