octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60509] First initialization of graphics subsy


From: Rik
Subject: [Octave-bug-tracker] [bug #60509] First initialization of graphics subsystem switches graphics_toolkit when octave-cli used
Date: Mon, 3 May 2021 16:20:04 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36

Follow-up Comment #5, bug #60509 (project octave):

Unfortunately, there seems to be a race condition in the C++ code.

The m-file code in graphics_toolkit.m and figure.m looks correct to me.  Up
until calling __go_figure__ in figure.m, the
"DefaultFigure__graphics_toolkit__" property of the graphics root object (0)
is properly set to "gnuplot".  After this call to C++, however, both the root
object and the newly created figure have "fltk" as the graphics toolkit.

The initialization of a figure is fiendishly complex.  It seems that near the
start all of the figure properties are initialized in graphics_props.cc.


graphics-props.cc:1327:  m["__graphics_toolkit__"] = default_graphics_toolkit
();


The default_graphics_toolkit function is defined as


static std::string
default_graphics_toolkit (void)
{
  octave::gtk_manager& gtk_mgr
    = octave::__get_gtk_manager__ ("default_graphics_toolkit");

  return gtk_mgr.default_toolkit ();
}


In stepping through the code, this returns "fltk" when "--no-gui-libs" option
is used and "qt" when "--no-gui" is used.  Octave is clearly trying for an
OpenGL toolkit.

The figure constructor in graphics-props.cc ends with a call to init() which
is a protected function in graphics.h for figures.  This function ends with a
call to init_toolkit ().  init_toolkit function is in graphics.cc and is
simple.


figure::properties::init_toolkit (void)
{
  octave::gtk_manager& gtk_mgr
    = octave::__get_gtk_manager__ ("figure::properties::init_toolkit");

  toolkit = gtk_mgr.get_toolkit ();
}


Before this function, the figure private variable "toolkit" points to one
location in memory.  After this, it points to another.  My guess is that this
is where the switch is happening.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60509>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]