Hi Pedro I'm sorry but I'm not sure I understand the point at which you get the segfault.
However, I think you are trying to call GetStream, before the stream has been created. The stream requires the window's device context at the point of creation, in order for the device context to exist the window must have been "Create"d. Often this is done by the constructor, but in this case to maintain generality the default wxWindow constructor is called which takes no parameters and does not create the window. An explicit call to wxSomeWindowType::Create is required - only once that has happened does the device context exist allowing the stream to be created. It would actually be very easy to have something like class myPlFrame :public wxPlWindow<wxFrame> { }; then have myPlFrame::myPlFrame(/*All the variables needed to initialise a wxFrame*/) { Create(/*The varibles from above*/); } Then you can call GetStream immediately after construction. On 9 December 2016 at 03:27, Pedro Vicente <pedro.vice...@space-research.org> wrote: > Alan, Thanks > Phil (I am CC you here, because this is a wxdriver issue; > not saying that is a bug in the wxdriver, just a code error I have in my use > of it ) > > The issue was not lack of -g, but just a code issue > > I am following almost verbatim the demo wxPLplotDemo.cpp > > what happens in my code is that > > pls is NULL > > here > > void Plot(wxPLplotwindow<WXWINDOW> *plotwindow) > { > wxPLplotstream* pls = plotwindow->GetStream(); > > so all pls-> calls seg fault > > > what happens is that this function is *not* called > > > void wxPLplotwindow<WXWINDOW>::OnCreate( wxWindowCreateEvent &event ) > { > if ( !m_created ) > > > and it should have been in these calls > > > wxPLplotwindow<wxFrame> *frame = new wxPLplotwindow<wxFrame>(); > frame->Create(NULL, wxID_ANY, wxT("wxPLplotDemo")); > frame->Show(); > Plot(frame); > > > This only happens in Linux, on Windows all is fine > > > so, I'll keep on debugging to see what is happening > > > by the way, since I am here, I have 2 small requests: > > 1) the wxdriver compilation has a couple of compiler warnings, would it be > possible to eliminate them ? > 2) would it be possible to keep in the upcoming version the old deprecated > wxdriver code that is not templated ? > I find templated code difficult to follow and debug, and here there is no > benefit in using it , because all my plots are in wxFrame > > these are the warnings > > > M:\star_icvs\tools\wx_lib\wx_plplotwindow.hpp(181): warning C4100: 'event': > unreferenced formal parameter (compiling source file wx_explorer_star.cpp) > M:\star_icvs\tools\wx_lib\wx_plplotwindow.hpp(182): note: while compiling > class template member function 'void > wx_PLplotwindow<wxFramePlot>::OnCreate(wxWindowCreateEvent &)' (compiling > source file wx_explorer_star.cpp) > wx_explorer_star.cpp(860): note: see reference to class template > instantiation 'wx_PLplotwindow<wxFramePlot>' being compiled > m:\star_icvs\tools\wx_lib\wx_plplotwindow.hpp(278): warning C4701: > potentially uninitialized local variable 'drawDc' used > m:\star_icvs\tools\wx_lib\wx_plplotwindow.hpp(278): warning C4703: > potentially uninitialized local pointer variable 'drawDc' used > > for the first you can use the > WXUNUSED > macro > > like in > void wxFrameClient::OnQuit(wxCommandEvent& WXUNUSED(eve)) > > the others seem that you should see > > m:\star_icvs\tools\wx_lib\wx_plplotwindow.hpp(278): warning C4701: > potentially uninitialized local variable 'drawDc' used > m:\star_icvs\tools\wx_lib\wx_plplotwindow.hpp(278): warning C4703: > potentially uninitialized local pointer variable 'drawDc' used > > > it says that the variables are not initialized and are potencially used > > > -Pedro > > ----- Original Message ----- From: "Alan W. Irwin" > <ir...@beluga.phys.uvic.ca> > To: "Pedro Vicente" <pedro.vice...@space-research.org> > Cc: <plplot-devel@lists.sourceforge.net> > Sent: Thursday, December 08, 2016 1:59 PM > Subject: Re: [Plplot-devel] build PLPlot with debug symbols in linux / cmake > > >> On 2016-12-08 01:52-0500 Pedro Vicente wrote: >> >>> >>> Hi Alan >>> >>> I have a wxWidgets application that I developed for Windows and Linux >>> that uses PLplot . >>> >>> I started having a segfault on the *Linux* only version. >>> >>> Debugging in Windows is a breeze with Visual Studio. >>> >>> For Linux I was able to make a QtCreator project to debug (yes, Qt >>> debugging wxWidgets !) >>> >>> However when I try to step into the PLplot code, there is no step into, >>> because probably debugging symbols were not built >>> >>> I used the following cmake call >>> >>> 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.1 >>> -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>>>>>> this is more probably a >>> cmake question, but I am not that familiar withcmake, so the question is,>> >>> how can I add debug symbols to PLPlot for the above cmake call?>> Hi >>> Pedro:>> I think there are some specific CMake options for making sure the >>> -g> option is used on all compilations, but the one I always use is to set> >>> the appropriate environment variables (which CMake recognizes as> well). So >>> before executing cmake in an initially empty build tree do> something like >>> the following:>> export CXXFLAGS=-g> export CFLAGS=-g> export FFLAGS=-g>> I >>> always just use the command line to build (with make) and debug> (with gdb) >>> rather than some IDE like QtCreator, but I assume setting> the above >>> environment variables will insure the QtCreator builds will> be done with >>> the -g option so that you can debug (likely with gdb> doing the work in the >>> background) with that IDE as well.>> Alan> __________________________> Alan >>> W. Irwin>> Astronomical research affiliation with Department of Physics >>> andAstronomy,> 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> >>> __________________________> ------------------------------------------------------------------------------ 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