From: Thomas B. <Tho...@gm...> - 2014-02-07 21:03:35
|
* Mojca Miklavec <moj...@gm...> [2014-02-07 12:37]: > On Fri, Feb 7, 2014 at 11:50 AM, Mojca Miklavec wrote: > > > > I wanted to test, but it seems that Qt terminal is broken on Mac now. > > The commit that broke gnuplot on Mac seems to be the following one: > > Author: sfeam <sfeam> > Date: Sat Oct 26 05:44:10 2013 +0000 > > explicit construction and destruction of qt_term data > > > +2013-10-26 Thomas Bleher > + > + * src/qtterminal/qt_term.cpp: Change the Qt terminal to only create its > + data when initialized (to avoid the Static Initialization Order Fiasco) > + and to destroy its data in a gnuplot atexit handler. > + > > but it's not a trivial commit and it would take me slightly more time > to figure out how it works and what exactly goes wrong. Hmm, this is strange. I have no idea how this patch could have broken the Mac build. As a short explanation: before this patch, several variables in qt_term.cpp were initialized statically. For types that have a constructor, this means that their constructor is called before main(). The order of initialization between different files is unspecified. So if one constructor depends on a static field in another file that is also initialized by a constructor, things may crash. This happened on Windows, where some Qt variable was initialized before the Qt library itself. This patch changed the code so that all variables that depend on Qt are initialized only after main() has started (so at a time when Qt is guaranteed to have been initialized). I don't have a Mac, so I can't test anything, unfortunately. Two things come to mind that you could look at: - Does this happen with the newest version of Qt4? It may be a bug that has already been fixed. - Does it work if you start gnuplot_qt manually? The qt terminal can connect to already running programs. To do this: - start gnuplot_qt - determine its pid - start gnuplot - call 'set terminal qt widget "qtgnuplot<pid>"', where <pid> is replaced by the numerical pid of the gnuplot_qt process - Try to plot something, e.g. "plot x" Hope this helps you. Thomas |