Re: [Plplot-devel] qt_example intermittent segfaults on exit

2018-12-29 Thread Alan W. Irwin

On 2018-12-29 21:45- António Rodrigues Tomé wrote:


Hi Alan
I just tried another thing as I was not feel comfortable by the fact that
apparently   QtExtWidget is setup in the main window
but free in the driver
however just found out that in fact the  plD_tidy_extqt( PLStream * pls
) is never reached.


Hi António:

That is an interesting result.  Normally, the way plD_tidy_extqt is called
is via plend1 which in turn is called by plend.  But there is no mention
of either of those in qt_example.cpp or qt_PlotWindow.cpp.
So based on a very quick look (so this is just slightly informed speculation),
I think part of the solution is to modify the PlotWindow destructor to
call plend to properly terminate PLplot.  In addition you
have to figure out a way to delete win instance of PlotWindow within 
qt_example.cpp
so that the PlotWindow destructor is actually called at the correct time.

But maybe if you completely rewrite extqt as you suggested, proper
termination will not be so difficult as this?  Anyhow, I leave the
solution of the qt_example termination issues we have been
discussing completely to you.


[...]In two months time I will look careful into this. [...]


Good!  I look forward to whatever solution you come up with then.

Alan
__
Alan W. Irwin

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
__


___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] qt_example intermittent segfaults on exit

2018-12-29 Thread António Rodrigues Tomé
Hi Alan
I just tried another thing as I was not feel comfortable by the fact that
apparently   QtExtWidget is setup in the main window
but free in the driver
however just found out that in fact the  plD_tidy_extqt( PLStream * pls
) is never reached.
I compiled the original qt_example that does not crash in my system against
a plplot build   where i put
void plD_tidy_extqt( PLStream * pls )
{

printf("passei aqui 1\n");
QtExtWidget * widget = NULL;

widget = (QtExtWidget *) pls->dev;
if ( widget != NULL )
{
handler.DeviceClosed( widget );
delete widget;
pls->dev = NULL;
}
 printf("passei aqui 2\n");

closeQtApp();
 printf("passei aqui 3\n");

}
just to make sure i really had the right build
I also put
void plD_init_extqt( PLStream * pls )
{
printf("passei aqui 0\n");




so I run qt_example play with it for a while. close it without any crash
but in my terminal the only thing there was
artome@linux-z41u:~/libplplotNOchanged/share/plplot5.14.0/examples/c++>
./qt_example
passei aqui 0
artome@linux-z41u:~/libplplotNOchanged/share/plplot5.14.0/examples/c++>

so in fact there is something strange with this driver and even the
discussion either to drop closeQtApp();call is pointless because
it seems never to occur.

In two months time I will look careful into this and eventually will add an
new driver based on qgraphicsview widget and storing things in vector
format.

cheers,

P.s.
just now I realize that there is portuguese text. So "passei aqui" means I
"reach this point", more or less.




On Sat, Dec 29, 2018 at 8:08 PM Alan W. Irwin 
wrote:

> On 2018-12-29 16:50- António Rodrigues Tomé wrote:
>
> > Hi Alan
> > it is easy to put this in a more standard qt way where plot win is not
> > defined as a pointer and  put win.show
> > replacing
> > //   a.setActiveWindow( win );
> > //   win->setVisible( true );
> > before the return a.exec()
> >
> > the fun thing is  that in this case the program always crashes when one
> > closes the window. It crashes when the destructor
> > of PlotWindow::~PlotWindow() is called.
> > it crashes there even if you empty the destructor. so I would conclude
> > something very wrong with the extqt driver.
>
> My experience was the same.  Any change I attempted caused reliable
> segfaults
> rather than rare segfaults.  So I agree there is some flaw in the current
> extqt device.
>
> > I'll promise to have a look,
> > and probably completely replace it by something different as I do not
> like
> > it, unlike the others that are nice.
>
> That would be great when you have time for this.
>
> Alan
> __
> Alan W. Irwin
>
> 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
> __
>


-- 

António Rodrigues Tomé
Universidade da Beira Interior
Instituto D. Luís (lab associado)
email address:
art...@gmail.com
art...@ubi.pt
http://www.researcherid.com/rid/A-5681-2013
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] qt_example intermittent segfaults on exit

2018-12-29 Thread Alan W. Irwin

On 2018-12-29 16:50- António Rodrigues Tomé wrote:


Hi Alan
it is easy to put this in a more standard qt way where plot win is not
defined as a pointer and  put win.show
replacing
//   a.setActiveWindow( win );
//   win->setVisible( true );
before the return a.exec()

the fun thing is  that in this case the program always crashes when one
closes the window. It crashes when the destructor
of PlotWindow::~PlotWindow() is called.
it crashes there even if you empty the destructor. so I would conclude
something very wrong with the extqt driver.


My experience was the same.  Any change I attempted caused reliable segfaults
rather than rare segfaults.  So I agree there is some flaw in the current
extqt device.


I'll promise to have a look,
and probably completely replace it by something different as I do not like
it, unlike the others that are nice.


That would be great when you have time for this.

Alan
__
Alan W. Irwin

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
__


___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] qt_example intermittent segfaults on exit

2018-12-29 Thread António Rodrigues Tomé
Hi Alan
it is easy to put this in a more standard qt way where plot win is not
defined as a pointer and  put win.show
replacing
//   a.setActiveWindow( win );
 //   win->setVisible( true );
before the return a.exec()

the fun thing is  that in this case the program always crashes when one
closes the window. It crashes when the destructor
of PlotWindow::~PlotWindow() is called.
it crashes there even if you empty the destructor. so I would conclude
something very wrong with the extqt driver. I'll promise to have a look,
and probably completely replace it by something different as I do not like
it, unlike the others that are nice.
Unfortunately I have a data workshop in Stockholm in the second week of
February and until there I have a huge amount of things to do.

cheers,

P.s i do Have interactive plplot apps in qt but I always render a png image
in a qgraphicsview widget. The png is built by plplot at exactly the same
pixels available in the window. and then I have a clock that replots
(rebuilding the image whenever the window size changes) I found long time
ago that this is much more faster than to have a vector format because the
rendering of that format into screen is much more slower than putting
plplot producing a new image for the new geometrie window, especially if
you don't use hardware acceleration.





On Sat, Dec 29, 2018 at 11:30 AM Alan W. Irwin 
wrote:

> On 2018-12-29 09:17- António Rodrigues Tomé wrote:
>
> > Unfortunately  I was not able to make qt-example seg fault in my system
> so
> > could not found out what was the problem.
>
> I could only trigger the segfaults in a busy environment, i.e., the
> interactive part of comprehensive testing with all sorts of other
> interactive tests going at the same time.  So I am not surprised you
> found it difficult to reproduce this issue.  However, if you try a valgrind
> run on qt_example, you should find like I did that there is
> a memory leak associated with win
> because the combination
>
> QApplication a( argc, argv );
> PlotWindow   * win = new PlotWindow( Argc, Argv );
> a.setActiveWindow( win );
> win->setVisible( true );
> [...]
> return a.exec();
>
> leaves some memory associated with win undeleted.  Note, cleanly
> deleting win is difficult (or at least I have had no success trying to
> do that without creating more segfaults) because of win's use by "a"
> above and the necessity (at least according to Qapplication
> documentation) that the exec method call be the last thing done in a main
> routine.
>
> Anyhow, if you can find some way to modify the above code so there is
> no memory leak associated with win, then that might solve the
> intermittent segfault on exit issue shown by qt_example.
>
> Alan
> __
> Alan W. Irwin
>
> 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
> __
>
>
> __
> Alan W. Irwin
>
> 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
> __
>


-- 

António Rodrigues Tomé
Universidade da Beira Interior
Instituto D. Luís (lab associado)
email address:
art...@gmail.com
art...@ubi.pt
http://www.researcherid.com/rid/A-5681-2013
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


[Plplot-devel] qt_example intermittent segfaults on exit

2018-12-29 Thread Alan W. Irwin

On 2018-12-29 09:17- António Rodrigues Tomé wrote:


Unfortunately  I was not able to make qt-example seg fault in my system so
could not found out what was the problem.


I could only trigger the segfaults in a busy environment, i.e., the
interactive part of comprehensive testing with all sorts of other
interactive tests going at the same time.  So I am not surprised you
found it difficult to reproduce this issue.  However, if you try a valgrind
run on qt_example, you should find like I did that there is
a memory leak associated with win
because the combination

QApplication a( argc, argv );
PlotWindow   * win = new PlotWindow( Argc, Argv );
a.setActiveWindow( win );
win->setVisible( true );
[...]
return a.exec();

leaves some memory associated with win undeleted.  Note, cleanly
deleting win is difficult (or at least I have had no success trying to
do that without creating more segfaults) because of win's use by "a"
above and the necessity (at least according to Qapplication
documentation) that the exec method call be the last thing done in a main 
routine.

Anyhow, if you can find some way to modify the above code so there is
no memory leak associated with win, then that might solve the
intermittent segfault on exit issue shown by qt_example.

Alan
__
Alan W. Irwin

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
__


__
Alan W. Irwin

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
__


___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel