Hi Phil >>I do have access to a CentOS machine at work, although I think I have >>only got access to wxWidgets 2.8 on that system.
What I usually do when I want to quick test on many unices , I install Virtual Box https://www.virtualbox.org/ For example on my Windows PC I have a CentOS and Ubuntu as virtual guests (not the ones I did the PLplot test) -Pedro ----- Original Message ----- From: "Phil Rosenberg" <p.d.rosenb...@gmail.com> To: "Pedro Vicente" <pedro.vice...@space-research.org>; <plplot-devel@lists.sourceforge.net> Sent: Saturday, December 10, 2016 3:57 AM Subject: Re: [Plplot-devel] wxPLplotDemo.cpp errors > Hi Pedro > I have included the devel list on this email, so the thread will get > documented on the mailing list. > > It is very strange that the OnCreate function is not being called. If > you are calling Create then you should be generating a create event. > Am I correct in saying that you are getting this segfault with the > unchanged demo app? > > This location really is the best (and maybe only) place this > initialisation should be done. It cannot be included in the > constructor, because the generic nature of the template specification > means the code in the constructor does not know which type of wxWindow > we are inheriting from so cannot pass the correct parameters to the > constructor. By the time OnPaint is called it is really too late, > because we would like to already have the plot initialised and ready > to draw and it would be a real pain for you in your code if you had to > somehow wait for the first paint or resize event. > > I do have access to a CentOS machine at work, although I think I have > only got access to wxWidgets 2.8 on that system. I will check. I may > be able to build 3.1 from source. I presume you are using 3.1.0 as > released in February, rather than the head of the master branch? > > On 10 December 2016 at 07:52, Pedro Vicente > <pedro.vice...@space-research.org> wrote: >> 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