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

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

Thread Previous | Thread Next
From:
Jan Dubois
Date:
November 17, 2003 08:46
Subject:
Re: need your help to do some (simple?) patching
Message ID:
3jthrv4bhqies0517ag8tuqd04l5asjh7d@4ax.com
On Mon, 17 Nov 2003 11:02:49 +0000, Nick Ing-Simmons
<nick.ing-simmons@elixent.com> 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
possible.
 
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.

Cheers,
-Jan


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About