bugGNU Octave - Bugs: bug #53342, Figure property IntegerHandle does...


bug #53342: Figure property IntegerHandle does not work fully with Qt toolkit

Submitted by:  Guillaume <gyom>
Submitted on:  Wed 14 Mar 2018 10:44:28 AM UTC  
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  Open
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Wed 02 Jan 2019 05:32:05 PM UTC, comment #10:

Since this no longer causes a crash I have marked this bug as fixed on the 5.0 release checklist. I've modified the Item Group on this bug report to "Feature Request" for the remaining two items.

Rik <rik5>
Project Administrator
Tue 17 Apr 2018 06:56:28 PM UTC, comment #9:

@Pantxo: Why are we storing the handle as a data member in the Figure object on the Qt side of things? Is it for performance?

It seems like any time we need the handle we could just get the property "__myhandle__" from the figure::properties object directly rather than using the cached m_handle value.

If we don't want to do the approach above, should we add a setter routine to the Figure object so that the renumber function could call it and update the m_handle variable?

Rik <rik5>
Project Administrator
Thu 29 Mar 2018 10:17:36 AM UTC, comment #8:

The fix for bug #53487 seems to prevent a segfault here too, thanks jwe.

There is still a problem in the two examples below when the figure handle changes value (the figure become unusable) but at least it's not crashing any more:

h = figure ("IntegerHandle", "off");
hgsave (h, "tmp.fig");
hgload ("tmp.fig"); # (the figure is there but invisible)

h = figure ();
uicontrol (h);
set (h, "IntegerHandle", "off");

Perhaps the title of this report could be updated to reflect the improvement?

Guillaume <gyom>
Mon 26 Mar 2018 10:16:55 AM UTC, comment #7:

Thanks for the feedbacks. First, a perhaps more interesting stack trace:

Thread 1 (Thread 0x7ffff7f9da00 (LWP 26240)):
#0 0x00007fffe65b0f67 in raise () at /lib64/libc.so.6
#1 0x00007fffe65b233a in abort () at /lib64/libc.so.6
#2 0x00007fffe731b2e5 in __gnu_cxx::__verbose_terminate_handler() () at /usr/lib64/libstdc++.so.6
#3 0x00007fffe73190d6 in () at /usr/lib64/libstdc++.so.6
#4 0x00007fffe7319121 in () at /usr/lib64/libstdc++.so.6
#5 0x00007fffe7319363 in () at /usr/lib64/libstdc++.so.6
#6 0x00007fffe7317fd2 in () at /usr/lib64/libstdc++.so.6
#7 0x00007ffff49e3bae in QtHandles::Object::properties<figure>() (this=0x601a0002f240)
at ../libgui/graphics/Object.h:59
#8 0x00007ffff49dd736 in QtHandles::Figure::update(int) (this=0x601a0002f240, pId=2037)
at ../libgui/graphics/Figure.cc:434
#9 0x00007ffff49e0bf7 in QtHandles::Figure::eventNotifyAfter(QObject*, QEvent*) (this=0x601a0002f240, watched=0x600e000344a0, xevent=0x7fffffffb770) at ../libgui/graphics/Figure.cc:795
#10 0x00007ffff499d7ce in QtHandles::GenericEventNotifySender::notifyReceiversAfter(QObject*, QEvent*) (this=0x600e000344d0, obj=0x600e000344a0, evt=0x7fffffffb770) at ./../libgui/graphics/GenericEventNotify.h:83
#11 0x00007ffff49d62a7 in QtHandles::ContainerBase::event(QEvent*) (this=0x600e000344a0, evt=0x7fffffffb770)
at ../libgui/graphics/Container.h:35
#12 0x00007ffff193128c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#13 0x00007ffff19358ea in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#14 0x00007ffff0c30be5 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#15 0x00007ffff19741ed in QWidget::setParent(QWidget*, QFlags<Qt::WindowType>) () at /usr/lib64/libQt5Widgets.so.5
#16 0x00007ffff197458e in QWidgetPrivate::init(QWidget*, QFlags<Qt::WindowType>) ()
at /usr/lib64/libQt5Widgets.so.5
#17 0x00007ffff1a28ccb in QAbstractButton::QAbstractButton(QAbstractButtonPrivate&, QWidget*) ()
at /usr/lib64/libQt5Widgets.so.5
#18 0x00007ffff1aba6e5 in QPushButton::QPushButton(QWidget*) () at /usr/lib64/libQt5Widgets.so.5
#19 0x00007ffff49fa3bb in QtHandles::PushButtonControl::create(graphics_object const&) (go=...)
at ../libgui/graphics/PushButtonControl.cc:47
#20 0x00007ffff49f3fdf in QtHandles::ObjectFactory::createObject(double) (this=0x7ffff4e4afe0 <QtHandles::ObjectFactory::instance()::s_instance>, handle=-1.3943829269174566) at ../libgui/graphics/ObjectFactory.cc:105
#21 0x00007ffff499f1ac in QtHandles::ObjectFactory::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x7ffff4e4afe0 <QtHandles::ObjectFactory::instance()::s_instance>, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x60040027c790) at libgui/graphics/moc-ObjectFactory.cc:74
#22 0x00007ffff0c5be26 in QObject::event(QEvent*) () at /usr/lib64/libQt5Core.so.5
#23 0x00007ffff193128c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#24 0x00007ffff19358ea in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#25 0x00007ffff0c30be5 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#26 0x00007ffff0c329ca in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
at /usr/lib64/libQt5Core.so.5
#27 0x00007ffff0c81b03 in () at /usr/lib64/libQt5Core.so.5
#28 0x00007fffe59a3134 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#29 0x00007fffe59a3388 in () at /usr/lib64/libglib-2.0.so.0
#30 0x00007fffe59a342c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#31 0x00007ffff0c8118c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
at /usr/lib64/libQt5Core.so.5
#32 0x00007ffff0c2ebfb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#33 0x00007ffff0c36ae6 in QCoreApplication::exec() () at /usr/lib64/libQt5Core.so.5
#34 0x00007ffff48b2dc0 in octave::gui_application::execute() (this=0x7fffffffc6e0)
at ../libgui/src/octave-gui.cc:202
#35 0x0000000000401d58 in main(int, char**) (argc=9, argv=0x7fffffffc918) at ../src/main-gui.cc:104

Now, unless there is a simple fix, I wonder if we shouldn't just make the "IntegerHandle" property read-only, with the only way to define it being during the construction of the figure, i.e.:

h = figure ("IntegerHandle", "off"); # OK
h = figure; set (h, "IntegerHandle", "off"); # not OK

The situation in which I came across this bug is the following:

h = figure ("IntegerHandle", "off");
hgsave (h, "tmp.fig");
hgload ("tmp.fig")

Interacting with the figure (e.g. a click on "Z+") creates a segfault. The issue here is with struct2hdl which creates a "naked" figure then adds properties, one at a time. Passing some or all of the properties when the figure is constructed would circumvent the bug found here and might anyway be a necessity as, for example, we will have anyway to do something like this for other properties such as "Visible" (to prevent a figure flashing when none was meant to be visible).

In summary, I think the use of the "IntegerHandle" property could be restricted without much loss of functionality, with struct2hdl modified accordingly. This would be a departure from Matlab but a small one in my opinion and this could be revisited when graphics handles as objects are introduced.

Guillaume <gyom>
Fri 23 Mar 2018 10:54:47 PM UTC, comment #6:

The problem is that the orignal figure handle is stored in the Figure object ("m_handle" member) and we try to use it to retrieve the figure properties. We currently have no mechanism to signal the handle value change.

Pantxo Diribarne <pantxo>
Project Member
Fri 23 Mar 2018 06:46:39 PM UTC, comment #5:

It seems that the real problem is that the Qt toolkit is not properly handling the switch to non-integer handles.

It works properly in the FLTK toolkit. To see what FLTK does, start here: http://hg.savannah.gnu.org/hgweb/octave/file/0b9e7fcaab91/libinterp/dldfcn/__init_fltk__.cc#l2343

In the QtHandles code, this function is called with pId set to ID_INTEGERHANDLE:


From there, the sendUpdate signal is emitted and handled in this function:


The default case is executed but by that point the object is no longer valid. So QtHandles doesn't update the internal value for the figure handle ID. Things get worse from that point on.

I'm not sure of what the proper fix is. I'm not sure we have enough information at that point to renumber the figure, so some significant changes may be needed.

John W. Eaton <jwe>
Project Administrator
Fri 23 Mar 2018 04:50:13 PM UTC, comment #4:

I don't know whether it will help in this case, but it is sometimes useful to get the stack traces for all the threads, not just the default one. Try

(gdb) thread apply all where

to see whether there are any other clues about what else is going on at the point of the crash.

John W. Eaton <jwe>
Project Administrator
Wed 14 Mar 2018 03:16:12 PM UTC, comment #3:

Confirmed. It also crashes Octave with other uicontrol styles.

Pantxo Diribarne <pantxo>
Project Member
Wed 14 Mar 2018 11:15:01 AM UTC, comment #2:

And here is the stack trace, unfortunately rather limited:

#0 0x00007fffeab130c7 in raise () at /lib64/libc.so.6
#1 0x00007fffeab14478 in abort () at /lib64/libc.so.6
#2 0x00007fffeb657b7d in __gnu_cxx::__verbose_terminate_handler() ()
at /usr/lib64/libstdc++.so.6
#3 0x00007fffeb655c06 in () at /usr/lib64/libstdc++.so.6
#4 0x00007fffeb655c51 in () at /usr/lib64/libstdc++.so.6
#5 0x00007fffeb655eb6 in __cxa_rethrow () at /usr/lib64/libstdc++.so.6
#6 0x00007ffff4a661f6 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQtCore.so.4
#7 0x00007ffff4a6b459 in QCoreApplication::exec() ()
at /usr/lib64/libQtCore.so.4
#8 0x00007ffff79a8683 in octave::gui_application::execute() (this=
0x7fffffffcca0) at ../libgui/src/octave-gui.cc:248
#9 0x00000000004019f4 in main(int, char**) (argc=9, argv=0x7fffffffcec8)
at ../src/main-gui.cc:104

Guillaume <gyom>
Wed 14 Mar 2018 11:01:48 AM UTC, comment #1:

I guess it's related to the number of the figure changing after the uicontrol being created as the following works:

h = figure ("IntegerHandle", "off");
uicontrol (h);

On the way, noticed that the "Number" property of a figure is missing, opening another bug report/feature request for that.

Guillaume <gyom>
Wed 14 Mar 2018 10:44:28 AM UTC, original submission:

Running this:

h = figure ();
uicontrol (h);
set (h, "IntegerHandle", "off");

and moving the mouse pointer to the button at the bottom left of the figure creates a segfault.

Guillaume <gyom>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by gyom (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-01-02 rik5 Item GroupSegfault, Bus Error, etc. => Feature Request
    2018-04-17 rik5 SummarySegfault in figure with property IntegerHandle set to off => Figure property IntegerHandle does not work fully with Qt toolkit
    2018-03-14 pantxo CategoryPlotting => Plotting with OpenGL
        StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.4