Hi Vadim,
>  FWIW I used (after reading documentation and wiki)
>
> -DwxWidgets_LIB_DIR=$wxwin/lib/vc_dll -DwxWidgets_CONFIGURATION=mswud
> -DwxWidgets_USE_UNICODE=ON -DDEFAULT_NO_BINDINGS=ON -DENABLE_cxx=ON
> -DENABLE_wxwidgets=ON -DDEFAULT_NO_DEVICES=ON -DPLD_wxwidgets=ON
>   
You should still have dynamic drivers enabled, i.e. the wxwidgets driver 
is compiled as a single dll and loaded on demand. Using the 
wxGraphicsContext backend from within a wxWidgets application is no 
problem though (don't know why exactly).
>  I didn't try reproducing this yet but my guess would be that it's just
> another example of deadlocking on the loader lock: you can't call
> FreeLibrary() (nor LoadLibrary() but this is more rare) from DllMain()
> because the DLL load mutex is locked when DllMain() is called and
> attempting to lock it again from FreeLibrary() deadlocks. So if lt_dlexit()
> is itself called from DllMain() this would explain it. And you should be
> able to find plenty more about this (painful) topic on the web, here is one
> of the first Google matches from a reputable source:
>
>    http://blogs.msdn.com/oldnewthing/archive/2004/01/28/63880.aspx
>
>
>  But even if the problem is almost surely due to this, fixing it might be
> non-trivial. I don't know PLplot well enough to see if there is a
> possibility to do the cleanup earlier, is there?
>   
Actually PLplot calls all drivers and ask them to tidy up. In the 
wxWidgets driver I do:

  if( dev->ownGUI ) {
    wxPLGetApp().RemoveFrame( dev->m_frame );
        if( !wxPLGetApp().FrameCount() )
        wxUninitialize();
  }
 
  delete dev;
  pls->dev=NULL;  /* since in plcore.c pls->dev is free_mem'd */

When I delete dev, the deconstructor of wxPLDevGC gets called (confirmed 
that). I would like to release the GDI stuff at this place, but this is 
not possible since the wxGDIPlusRenderer is  defined in graphics.cpp:

static wxGDIPlusRenderer gs_GDIPlusRenderer;

and the deconstructor will be called when this object will be destroyed 
- presumably when FreeLibrary is called. Then gdiplus is also shutdown

    if ( m_gditoken )
        GdiplusShutdown(m_gditoken);

I could try to define my own GDIPlus renderer to have complete control 
when the renderer is destroyed - but I'm not sure if this solves the 
problem. Or should I write my own dllmain function for the plplot 
library or wxwidgets driver?

I'll post when I find something. Thank you very much for this hint - I 
can try now different approaches to get hold of this bug.

Regards,
Werner


-- 
Dr. Werner Smekal
Institut fuer Allgemeine Physik
Technische Universitaet Wien
Wiedner Hauptstr 8-10
A-1040 Wien
Austria
DVR-Nr: 0005886

email: [email protected]
web:   http://www.iap.tuwien.ac.at/~smekal
phone: +43-(0)1-58801-13463 (office)
       +43-(0)1-58801-13469 (laboratory)
fax:   +43-(0)1-58801-13499


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Plplot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to