[wxPython] Multiple instances of wxApp

Multiple instances of wxApp

This is kind of a weird use-case, but in an automated unit test

I instantiate two different subclasses of wxApp (sequentially, not

at the same time) and run MainLoop() on each. Everything works

fine until exit and I get the object leak error messages that one

of the wxApp objects did not get cleaned up. I to ensure that

both app objects got deleted by removing references to them,

but nothing I tried works.

Is this just a unsupported use-case, or is there some other problem

with wxApp?

···

Jeff Kotula Sr. Principal Software Engineer

Vital Images jkotula@vitalimages.com

Renunciation is not giving up the things of this world,

but accepting that they go away.

            -- Suzuki Roshi

Multiple instances of wxApp
Try calling myApp.Destroy() after the main loop of the second wxApp instance.

Matthew Sherborne

···

----- Original Message -----

From:
Jeff Kotula

To: ‘wxpython-users@lists.wxwindows.org’

Sent: Friday, April 26, 2002 2:34 AM

Subject: [wxPython] Multiple instances of wxApp

This is kind of a weird use-case, but in an automated unit test
I instantiate two different subclasses of wxApp (sequentially, not
at the same time) and run MainLoop() on each. Everything works

fine until exit and I get the object leak error messages that one
of the wxApp objects did not get cleaned up. I to ensure that
both app objects got deleted by removing references to them,
but nothing I tried works.

Is this just a unsupported use-case, or is there some other problem
with wxApp?


Jeff Kotula Sr. Principal Software Engineer
Vital Images jkotula@vitalimages.com

Renunciation is not giving up the things of this world,
but accepting that they go away.
– Suzuki Roshi

This is kind of a weird use-case, but in an automated unit test
I instantiate two different subclasses of wxApp (sequentially, not
at the same time) and run MainLoop() on each. Everything works
fine until exit and I get the object leak error messages that one
of the wxApp objects did not get cleaned up. I to ensure that
both app objects got deleted by removing references to them,
but nothing I tried works.

Is this just a unsupported use-case, or is there some other problem
with wxApp?

There is some code in wxPython that assumes that the wxApp object is a
singleton. That probably isn't really needed anymore, but I'd rather not
jump into that code right now as I'm juggling many other things right now.
Mathew's suggestion of calling Destroy should work. On the other hand, as
long as there are not multiple simultaneous instances, it probably doesn't
matter if the old ones are destroyed or not...

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!