Hi Phil My idea for a fix is to move the stream initialization that is now on
void wxPLplotwindow<WXWINDOW>::OnCreate( wxWindowCreateEvent &event { if ( !m_created ) either to the OnSize or onPaint events void wxPLplotwindow<WXWINDOW>::OnSize( wxSizeEvent& WXUNUSED( event ) ) and also in the plot call do this template< class WXWINDOW > void Plot( wxPLplotwindow<WXWINDOW> *plotwindow ) { wxPLplotstream* pls = plotwindow->GetStream(); if (pls == NULL) { return; } Like this , in this sequence wxPLplotwindow<wxFrame> *frame = new wxPLplotwindow<wxFrame>(); frame->Create( NULL, wxID_ANY, wxT( "wxPLplotDemo" ) ); frame->SetIcon( wxIcon( graph ) ); frame->Show(); Plot( frame ); first we go to Plot( frame ); but the stream is NULL because :OnCreate was not called, but the function returns, avoiding the seg fault then the window gets a paint or size event, and the stream initialization code is called at this time I have a PLplot empty black window but because Plot( frame ); was only called at start, it is not called again, so there is no draw any ideas here ? of course making the Plot() call in another app function should work If you could replicate this issue, that would be great. I am using CentOS 6.8, PLplot.5.11.1 , wxWidgets 3.1.0 ----- Original Message ----- From: Pedro Vicente To: plplot-devel@lists.sourceforge.net ; Phil Rosenberg Sent: Saturday, December 10, 2016 12:59 AM Subject: Re: [Plplot-devel] wxPLplotDemo.cpp errors Hi Phil So, the issue seems to be the same that I have been reporting In the wxPLplotDemo.cpp code you have these callling functions wxPLplotwindow<wxFrame> *frame = new wxPlDemoFrame(); frame->Create( NULL, wxID_ANY, wxT( "wxPLplotDemo" ) ); that make 2 calls to the PLplot library, or the wxWidgets driver of it all these calls are in the header file wxPLplotwindow.h first the constructor is called template<class WXWINDOW> wxPLplotwindow<WXWINDOW>::wxPLplotwindow( bool useGraphicsContext, wxSize clientSize ) : m_created( false ), m_initialSize( clientSize ) then this call OnCreate() is called, like you mentioned and the !m_created bool makes the initialization of the stream happen the problem is that this function id *NOT* called on my linux build (it is on the Windows build) so therefore later wxPLplotstream* pls = plotwindow->GetStream(); this is NULL, so therefore it seg faults on the plot calls //! This is called when the widow is created i.e. after WXWINDOW::Create // has been called. We note that this has been called to avoid attempting // to redraw a plot on a window that hasn't been created yet. template<class WXWINDOW> void wxPLplotwindow<WXWINDOW>::OnCreate( wxWindowCreateEvent &event ) { if ( !m_created ) so, one quick try is to put the code of void wxPLplotwindow<WXWINDOW>::OnCreate that is not called on the constructor maybe ? -Pedro ----- Original Message ----- From: Pedro Vicente To: plplot-devel@lists.sourceforge.net ; Phil Rosenberg Sent: Friday, December 09, 2016 11:57 PM Subject: [Plplot-devel] wxPLplotDemo.cpp errors Hi Phil So, resuming the last thread about wxWidgets, what I did was to build and run wxPLplotDemo.cpp from PLpplot 5.11.1 on CentOS 6.8 all builds fine, but when I do run , I get a seg fault [pedro.vicente@rhw9121 c++]$ cd /data/home002/pvicente/plplot/build/examples/c++ [pedro.vicente@rhw9121 c++]$ ./wxPLplotDemo Segmentation fault I know that only this information is not much help to you to debug, but in the next couple of days I'll be debugging this and posting here any solution. my cmake call was cmake .. -G "Unix Makefiles" -DBUILD_SHARED_LIBS:BOOL=OFF -DENABLE_f95:BOOL=OFF -DENABLE_tcl:BOOL=OFF -DENABLE_tk:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=/data/data127/pvicente/install/plplot-5.11.1d -DPL_HAVE_PTHREAD:BOOL=OFF -DPLD_xwin:BOOL=OFF -DPLD_wxwidgets:BOOL=ON -DwxWidgets_ROOT_DIR:PATH=/data/data127/pvicente/install/wxwidgets-3.1.0 -DwxWidgets_LIB_DIR:PATH=/data/data127/pvicente/install/wxwidgets-3.1.0/lib -DwxWidgets_CONFIGURATION=mswud -DENABLE_MIX_CXX=ON -DwxWidgets_EXCLUDE_COMMON_LIBRARIES:BOOL=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_TEST:BOOL=ON >& cmake.txt & the output of cmake and make are attached -Pedro ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/xeonphi _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/xeonphi _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/xeonphi _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel