I have a program with NotifyIcon in a program that does a fork(). When the child process exits, it calls the destructor for NotifyIcon and the parent process hangs.

I get a warning about 'use of unitialized value' at GUI.pm line 2400:

   Win32::GUI::NotifyIcon::Delete(
       $self->{-parent},
       -id => $self->{-id},
   );

By process of elimination, I discovered that $self->{-parent} is the unitialized value it's complaining about here. But this doesn't occur if I exit the parent without fork()ing the child, and if I exit the parent process first, the error occurs upon exiting the child process. I checked, and $self->{-parent} is still defined after my system() call. I call exit() right after system(), so something is happening during global destruction that destroys the Window object before calling NotifyIcon::Delete - but only with a child process, not with the parent process. And it apparently destroys it for the parent process as well, although I thought fork()ing was supposed to give the child process a copy of the memory, not access to the parent's memory.

I tried fixing it by adding
   return unless (defined ($self->{-parent}));
right before the code above, but the parent process still hangs even though I don't get the error message.

I used to have this program in a small window, and it worked fine. Once I added a NotifyIcon, though, I started getting this error.

Has anyone else run into this error?

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


Reply via email to