Hi Phil

I am using the attached qt project file on my CentOS 6.8 build, adapted to build
examples/c++/wxPLplotDemo.cpp

to use, place the file in
examples/c++

just change these lines for your own case

dir_inc_plplot = /data/home002/pvicente/plplot-plplot-install/include/plplot
 dir_lib_plplot = /data/home002/pvicente/plplot-plplot-install/lib
dir_inc_wx = /data/data127/pvicente/install/wxwidgets-3.1.0d/include/wx-3.1 dir_inc_wx_setup = /data/data127/pvicente/install/wxwidgets-3.1.0d/lib/wx/include/gtk2-unicode-static-3.1
 dir_lib_wx = /data/data127/pvicente/install/wxwidgets-3.1.0d/lib

in QtCreator change in Projects/Run, disable the  the "Run in Terminal"

this is the stack on the window creation as shown in QtCreator


0       wxWindow::PostCreation  window.cpp      2753    0x4d9ea4
1       wxTopLevelWindowGTK::Create     toplevel.cpp    674     0x4cdb79
2       wxFrame::Create frame.cpp       48      0x4e672b
3       MyApp::OnInit   wxPLplotDemo.cpp        148     0x4259d8
4       wxAppConsoleBase::CallOnInit    app.h   93      0x426c23
5       wxEntry init.cpp        487     0x6bf36d
6       wxEntry init.cpp        515     0x6bf475
7       main    wxPLplotDemo.cpp        131     0x4258a4


As opposed to the wxWidgets Windows build, that uses the WIN32 API, for linux it's a totally different API (GTK),
so the issue may be a wxWidgets GTK code thing

-Pedro

On 2016-12-14 10:59, Pedro Vicente wrote:
Hi Phil

Were you able to reproduce the error I get on my linux builds of
wxPLplotDemo?

I just did a git clone of the last plplot and I still get the error

see my last email from today, there are instructions on how to debug
with Qt

project here


https://github.com/pedro-vicente/plplot-wxwidgets/blob/master/wx_plplot/wx_plplot.qt.ubuntu.x86_64.pro

then install QtCreator

https://www.qt.io/download-open-source/#section-2

and use the file wx_plplot.qt.ubuntu.x86_64.pro

what I did

git clone http://git.code.sf.net/p/plplot/plplot plplot-plplot

then I edited the file examples/c++/wxPLplotDemo.cpp and added this
assert here

wxPLplotstream* pls = plotwindow->GetStream();
assert(pls);

just to make sure this is the issue.
then

cd plplot-plplot
cmake ..  -G "Unix Makefiles" -DBUILD_SHARED_LIBS:BOOL=OFF
-DENABLE_f95:BOOL=OFF -DENABLE_tcl:BOOL=OFF -DENABLE_tk:BOOL=OFF
-DBUILD_TEST:BOOL=ON >& cmake2.txt &
make >& make2.txt &
cd examples/c++/
./wxPLplotDemo
wxPLplotDemo:

/data/home002/pvicente/plplot-plplot/examples/c++/wxPLplotDemo.cpp:158:
void Plot(wxPLplotwindow<WXWINDOW>*) [with WXWINDOW = wxFrame]:
Assertion `pls' failed.
Aborted




On 2016-12-10 03:57, Phil Rosenberg wrote:
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

--
Pedro Vicente
pedro.vice...@space-research.org
http://www.space-research.org/


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

--
Pedro Vicente
pedro.vice...@space-research.org
http://www.space-research.org/
# usage : 
# make -f Makefile
# make -f Makefile clean
# wx-config --cxxflags
# wx-config --libs

TEMPLATE = app
TARGET = wxPLplotDemo_qt
QT -= gui
CONFIG += console
CONFIG += debug
CONFIG += static
lessThan(QT_MAJOR_VERSION, 5) {
QMAKE_CXXFLAGS += -std=c++0x
} else {
CONFIG += c++11
}

HDR1 =
SRC1 =
SRC_MAIN1 = wxPLplotDemo.cpp

unix {
 DEFINES += _FILE_OFFSET_BITS=64 
 DEFINES += __WXGTK__ 
 DEFINES += pthread

 dir_inc_plplot = /data/home002/pvicente/plplot-plplot-install/include/plplot
 dir_lib_plplot = /data/home002/pvicente/plplot-plplot-install/lib
 dir_inc_wx = /data/data127/pvicente/install/wxwidgets-3.1.0d/include/wx-3.1
 dir_inc_wx_setup = 
/data/data127/pvicente/install/wxwidgets-3.1.0d/lib/wx/include/gtk2-unicode-static-3.1
 dir_lib_wx = /data/data127/pvicente/install/wxwidgets-3.1.0d/lib


 INCLUDEPATH += $${dir_inc_plplot}
 INCLUDEPATH += $${dir_inc_wx}
 INCLUDEPATH += $${dir_inc_wx_setup}
 INCLUDEPATH += ../wx_lib

 QMAKE_LIBDIR += $${dir_lib_plplot}
 LIBS += -lplplotwxwidgets 
 LIBS += -lplplotcxx
 LIBS += -lplplot
 LIBS += -lcsirocsa
 LIBS += -lqsastime
 QMAKE_LIBDIR += $${dir_lib_wx}
 LIBS += -lwx_gtk2u_xrc-3.1
 LIBS += -lwx_gtk2u_qa-3.1
 LIBS += -lwx_baseu_net-3.1
 LIBS += -lwx_gtk2u_html-3.1
 LIBS += -lwx_gtk2u_adv-3.1
 LIBS += -lwx_gtk2u_core-3.1
 LIBS += -lwx_baseu-3.1
 LIBS += -pthread
 LIBS += -lX11
 LIBS += -lXxf86vm
 LIBS += -lSM
 LIBS += -lgtk-x11-2.0
 LIBS += -lgdk-x11-2.0
 LIBS += -latk-1.0
 LIBS += -lgio-2.0
 LIBS += -lpangoft2-1.0
 LIBS += -lpangocairo-1.0
 LIBS += -lgdk_pixbuf-2.0
 LIBS += -lcairo
 LIBS += -lpango-1.0
 LIBS += -lfreetype
 LIBS += -lfontconfig
 LIBS += -lgobject-2.0
 LIBS += -lgmodule-2.0
 LIBS += -lgthread-2.0
 LIBS += -lrt
 LIBS += -lglib-2.0
 LIBS += -lpng
 LIBS += -ljpeg
 LIBS += -lexpat
 LIBS += -lwxregexu-3.1
 LIBS += -lwxtiff-3.1
 LIBS += -lz -ldl
 LIBS += -lm
 LIBS += -llzma 
 
 QMAKE_LFLAGS += -Wl,-rpath,$${dir_lib_wx}
 QMAKE_LFLAGS += -Wl,-rpath,$${dir_lib_plplot}
 
 HEADERS += $${HDR1}
 SOURCES += $${SRC1} $${SRC_MAIN1}
}




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to