On Fri, Mar 13, 2009 at 11:19:08AM +0000, Alban Rochel wrote:
> Andrew Ross wrote:
> > On Fri, Mar 13, 2009 at 09:25:43AM +0000, Alban Rochel wrote:
> >> Andrew Ross wrote:
> > 
> > This is interesting - we're running exactly the same system, but mine is 
> > on a 32-bit machine. Perhaps this is a 32-bit / 64-bit issue?
> > 
> > Andrew
> 
> Andrew,
> 
> I cannot reproduce this bug on my Kubuntu32 8.10 virtual machine, with 
> Qt4.4.3. *Really* weird.
> 
> Alban

Alban,

I have tried again on a 64-bit machine I have access to with kubuntu
8.10 on as well. On this machine I get a segfault rather than the
"double free" message I saw on the 32-bit system. In fact, going back
to the 32-bit version I now seem to not always get a crash, however
valgrind shows that there is definitely an invalid call to free.

I have also tried on a Debian 5.0 (Lenny) system with the same results. 

Running valgrind on the each systems shows the error is occuring when
XCloseDevice is being called by the QApplication destructor. The
unpredicable failure is classic symptoms of accessing undefined
memory / pointer problems and can make debugging hard. There are invalid
reads of memory when initialising the QApplication which seem to be
related to X functions. 

... and this proves to be the key point.

The QApplication constructor includes an additional argument which is
a boolean which controls whether to enable the GUI. Setting this to
false, so the program is just a console app fixes all my problems related
to Qt file devices. The examples then run without any access issues being
picked up by valgrind. Obviously the qtwidget device requires
initialisation as a GUI. 

I've added code so initQtApp is called with a bool isGUI which can then
be passed to QApplication. Obviously this does mean that the driver is
not entirely thread-safe. In particular attempts to use the qtwidget
device and a qt file device at the same time are likely to result in
unpredictable results.

It does however fix things for me and ctest again runs successfully. 

Note the documentation suggests that this GUI / not GUI difference is
only an issue on Unix. On Mac/Windows the GUI is currently always
initialised. 

Andrew


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to