Hi Alan
I'll run the tests you suggest today some time (balancing kids and decorating at the moment) and send in the patch. I have also found that simply not calling wxUninitialize() when we destroy the first window allows the second window to work as normal. For some reason it seems that on Linix wxWidgets does not like being repeatedly initialise and uninitialized. If I can sort out a source code build of wxWidgets I will try to dig deeper.
 
Looking through the source on Windows it looks like initializing multiple times does not cause problems as there is a check to avoid this. I'm not sure if failing to unitialize will cause a memory leak on exit - perhaps this is less bad than a segfault anyway?
 
Alternatively is there a point in the plplot initialization/uninitialization which could allow wxWidgets to be initialized/uninitialized exactly once per application?
 
I will post something on the wxWidgets forum to see if thereis something I'm missing.
 
Phil

From: Alan W. Irwin <irwin@beluga.phys.uvic.ca>
To: phil rosenberg <philip_rosenberg@yahoo.com>
Cc: Werner Smekal <werner.smekal@miscdebris.net>; Werner Smekal <smekal@iap.tuwien.ac.at>; fulvio ciriaco <oivulf@gmail.com>; "plplot-devel@lists.sourceforge.net" <plplot-devel@lists.sourceforge.net>; "fulviociriaco@users.sourceforge.net" <fulviociriaco@users.sourceforge.net>
Sent: Sunday, 24 February 2013, 5:48
Subject: Re: [Plplot-devel] [ plplot-Bugs-3604554 ] wxwidgets window

On 2013-02-23 17:02-0800 phil rosenberg wrote:

> I should now be able to supply a patch that give correct operation
and closure of a single window and allows the console to continue
running without the orphaned window. Would you like that as a patch
now with possibly more to follow?

Hi Phil:

Please go ahead and send your proposed patch as an attachment to this
list. I don't understand the wxwidgets device driver that well, but if
I find here that your patch builds and runs using all our standard C
examples without issues on Linux (using the test_c_wxwidgets target)
as well as reducing the test.c issues like you describe, then I would
be strongly inclined to apply it.

Of course, I would also follow the advice of Werner (who is familiar
with the wxwidgets code since he is its original implementer)
concerning your proposed patch _if_ he gets in touch.  There has been
no response to my first attempt to contact him, and in fact it appears
that the SourceForge mailer filtered out the CC to him for some
reason. So this time, I am CCing to the last two known addresses for
him to see if that will get a response.  But meanwhile, Phil, please
send your patch so I can try the test_c_wxwidgets target with it (and
you may want to try that target yourself on Linux first (using "make
test_c_wxwidgets" if you have first run cmake with the -DBUILD_TEST=ON
option).

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________