If anyone could offer any insight here, it would be greatly 
aprpecaited.  I
have been struggling with Win32::GUI for a few days now, and I keep running
into the same problem.  Using ActivePerl (the latest build, I can't remember
the build number off the top of my head) inside a Windows Script Host
environment, the host application consistently crashes every single time I
return -1 from an event handler to terminate the message loop.  It seems
like as soon as the message loop exits, somebody, somewhere, tries to do
some cleanup and dereferences a null pointer somewhere along the line.
That's a best-guess on my part, as the host application is SoftQuad XMetaL
3, and I have no debugging symbols for it, or ActivePerl, and I can't figure
out if it's even possible to attach a debugger to a Win32::GUI app running
in such a fashion.  The only way I can get it to NOT crash is inside the
_Terminate event handler, by calling PostQuitMessage, and then returning 1,
which seems to destroy the window, and the application never crashes.  I can
delay the crash until somebody exits the application by hiding the window(s)
and returning 1 from my event handlers, but all that does is keep the window
handles floating around until the application closes, and then it crashes.
I need to make the windows shut down after a user clicks on certain buttons,
and I just can't seem to do it without making everything crash and burn.
Here are the things I've tried so far:

Calling $Window->PostQuitMessage from inside my button event handlers
Returning -1 from my event handlers
Loading the DestroyWindow function through Win32::API, and then calling it
with the {-handle} of my main window
Calling $Window->DestroyWindow
Calling $Window->PostMessage(WM_QUIT, 0, 0)
   ""        ""       ""     WM_DESTROY

And just about every single combination thereof.  I can't track down the
problem much more specifically, but I know it happens when the
Win32::GUI::Dialog loop terminates, and I know it crashes inside of
Perl56.dll somewhere.  I think a lot of it just has to do with the fact that
were I not running in a somewhat persistent Windows Script Host environment,
more garbage collection would be done by perl, but since I can't force a
reload of the scripting environment, I'm kind of stuck... I've also tried
everything I could think of to trick perl into running a garbage collection
pass on my windows, but they all ended up with the application crashing at
one point or another.

  If I can't get this to work, I'll be forced to use Visual Studio, and I
_REALLY_ don't want to :) So if anyone has had any similar problems, or has
any ideas, I'd really love to hear them.

Thanks,

Chris


Reply via email to