wx.TaskBarIcon multiplying on explorer.exe crash

Hi,

I'm having a really odd issue with one of my programs that has two instances of TaskBarIcon. I used the code from the demo and made two classes with different names. One icon is for the main program and the 2nd icon (which looks like an envelope) will appear only when I get new email. If I read all the email, it will destroy itself the next time it checks my mail server.

This program runs exclusively on Windows XP SP2 or SP3.

So, here's the issue. From time to time, explorer.exe locks up and needs to be killed. Upon killing and restarting it from the Task Manager, my envelope icon will multiply itself for each unread email I have. Since I work in an IT department, we get a lot of status emails from our network, so I may end up with 30-60 email icons in my system tray. To get rid of them, I have to close the entire program and mouse over the icons.

For some reason, this does not happen to the main icon.

Here's how I instantiate the 2nd icon:

<code>

if self.unread_emails >= 1:
    try:
        self.email_icon.RemoveIcon()
        self.email_timer.Stop()
    except: pass
    self.email_icon = mail_TBIcon.MailIcon(self.frame, self.unread_emails, self.temp_lst)

    self.lastChecked = 0
    self.email_timer = wx.Timer(self)
    self.email_timer.Start(60000)
    self.Bind(wx.EVT_TIMER, self.emailChecker, self.email_timer)
else:
    try:
        self.email_timer.Stop()
        self.email_icon.RemoveIcon()
    except: pass

</code>

And yes, I know bare try/except statements are bad. Any ideas why this is happening though? I seem to only have this issue in my binary version (which I created with GUI2exe) and not if I run it straight from code.

I am using wxPython 2.8.7.1 with Python 2.5. Thanks!

Mike Driscoll
Applications Specialist