Skip to content

Plot Docker Toolbar Close ("X") Button can cause a Seg Fault #1052

Open
@dotto44

Description

@dotto44

Sometimes, when pressing the plot docker close button, it leads to a segfault. This is difficult to reproduce consistently manually, but can be reproduced consistently is you use some automation tool to click the close button (e.g. I wrote a script with PyAutoGUI to click the button which reproduces it 100% of the time).

It seems there is a race condition where dockAreaWidget() can be null in the mouse event.

void DockToolbar::mouseReleaseEvent(QMouseEvent* ev)
{
  _parent->dockAreaWidget()->titleBar()->mouseReleaseEvent(ev);
}

Very short video of it reproducing:

https://www.youtube.com/watch?v=KKwxzcyv_Mk

Backtrace:

Thread 1 "plotjuggler" received signal SIGSEGV, Segmentation fault.
0x00005555557c9c04 in ads::CDockAreaWidget::titleBar (this=0x0)
    at /home/dillon/git/PlotJuggler/3rdparty/Qt-Advanced-Docking/src/DockAreaWidget.cpp:958
958		return d->TitleBar;
(gdb) bt
#0  0x00005555557c9c04 in ads::CDockAreaWidget::titleBar (this=0x0)
    at /home/dillon/git/PlotJuggler/3rdparty/Qt-Advanced-Docking/src/DockAreaWidget.cpp:958
#1  0x00005555556e29d2 in DockToolbar::mouseReleaseEvent (this=0x555556505c60, 
    ev=0x7fffffffcff0)
    at /home/dillon/git/PlotJuggler/plotjuggler_app/plot_docker_toolbar.cpp:67
#2  0x00007ffff77b1258 in QWidget::event(QEvent*) ()
   from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#3  0x00007ffff776bef5 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#4  0x00007ffff7773c14 in QApplication::notify(QObject*, QEvent*) ()
   from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#5  0x00007ffff6ae8c98 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
    () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff777252d in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) ()
   from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#7  0x00007ffff77cbcb7 in ?? () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#8  0x00007ffff77cf3cf in ?? () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff776bef5 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007ffff6ae8c98 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
    () from /lib/x86_64-linux-gnu/libQt5Core.so.5
--Type <RET> for more, q to quit, c to continue without paging--
#11 0x00007ffff6f4ab87 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) ()
   from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#12 0x00007ffff6f1afac in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#13 0x00007ffff24f63f6 in ?? () from /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#14 0x00007ffff5710397 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff5770dc7 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff570f8b3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007ffff6b47afd in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff6ae75ab in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007ffff6af0286 in QCoreApplication::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x000055555561d40a in main (argc=1, argv=0x7fffffffdd38)
    at /home/dillon/git/PlotJuggler/plotjuggler_app/main.cpp:484

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions