Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global dbus menus results in segfault when windowstate is restored. #992

Closed
jsm222 opened this issue Sep 6, 2022 · 1 comment · Fixed by #993
Closed

Global dbus menus results in segfault when windowstate is restored. #992

jsm222 opened this issue Sep 6, 2022 · 1 comment · Fixed by #993

Comments

@jsm222
Copy link
Contributor

jsm222 commented Sep 6, 2022

When exporting menus from qterminal either in helloSystem or kde5 MainWindow::bookmarksDock_visibilityChanged
is called early (from who knows where) and results in segfault in
TermWidgetHolder::currentTerminal (this=0x0) at /usr/ports/x11/qterminal/work/qterminal-1.1.0/src/termwidgetholder.cpp:136
because consoleTabulator->terminalHolder() is null.

#0  TermWidgetHolder::currentTerminal (this=0x0) at /usr/ports/x11/qterminal/work/qterminal-1.1.0/src/termwidgetholder.cpp:136
#1  0x0000000000242066 in MainWindow::bookmarksDock_visibilityChanged (this=0x803683c80, visible=false) at /usr/ports/x11/qterminal/work/qterminal-1.1.0/src/mainwindow.cpp:873
#2  0x0000000000251989 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<bool>, void, void (MainWindow::*)(bool)>::call (
    f=(void (MainWindow::*)(MainWindow * const, bool)) 0x241ff0 <MainWindow::bookmarksDock_visibilityChanged(bool)>, o=0x803683c80, arg=0x7fffffffcbf0) at /usr/local/include/qt5/QtCore/qobjectdefs_impl.h:152
#3  0x00000000002518dd in QtPrivate::FunctionPointer<void (MainWindow::*)(bool)>::call<QtPrivate::List<bool>, void> (f=(void (MainWindow::*)(MainWindow * const, bool)) 0x241ff0 <MainWindow::bookmarksDock_visibilityChanged(bool)>, 
    o=0x803683c80, arg=0x7fffffffcbf0) at /usr/local/include/qt5/QtCore/qobjectdefs_impl.h:185
#4  0x0000000000251822 in QtPrivate::QSlotObject<void (MainWindow::*)(bool), QtPrivate::List<bool>, void>::impl (which=1, this_=0x8037bd1c0, r=0x803683c80, a=0x7fffffffcbf0, ret=0x0)
    at /usr/local/include/qt5/QtCore/qobjectdefs_impl.h:418
#5  0x0000000801c4b4ae in QtPrivate::QSlotObjectBase::call (this=0x8037bd1c0, r=0x803683c80, a=0x7fffffffcbf0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#6  0x0000000801c97935 in doActivate<false> (sender=0x80916b080, signal_index=10, argv=0x7fffffffcbf0) at kernel/qobject.cpp:3886
#7  0x0000000801c8fc19 in QMetaObject::activate (sender=0x80916b080, m=0x800ea3690 <QDockWidget::staticMetaObject>, local_signal_index=3, argv=0x7fffffffcbf0) at kernel/qobject.cpp:3946
#8  0x0000000800af1dd8 in QDockWidget::visibilityChanged (this=0x80916b080, _t1=false) at .moc/moc_qdockwidget.cpp:308
#9  0x0000000800af195f in QDockWidget::event (this=0x80916b080, event=0x7fffffffd910) at widgets/qdockwidget.cpp:1534
#10 0x0000000800945307 in QApplicationPrivate::notify_helper (this=0x80365c000, receiver=0x80916b080, e=0x7fffffffd910) at kernel/qapplication.cpp:3637
#11 0x0000000800949e04 in QApplication::notify (this=0x80361a940, receiver=0x80916b080, e=0x7fffffffd910) at kernel/qapplication.cpp:3587
#12 0x0000000801c35333 in QCoreApplication::notifyInternal2 (receiver=0x80916b080, event=0x7fffffffd910) at kernel/qcoreapplication.cpp:1064
#13 0x0000000801c35fa8 in QCoreApplication::sendEvent (receiver=0x80916b080, event=0x7fffffffd910) at kernel/qcoreapplication.cpp:1462
#14 0x000000080099eefd in QWidgetPrivate::hide_helper (this=0x803659e80) at kernel/qwidget.cpp:7960
#15 0x000000080099f790 in QWidgetPrivate::setVisible (this=0x803659e80, visible=false) at kernel/qwidget.cpp:8146
#16 0x000000080099f2b0 in QWidget::setVisible (this=0x80916b080, visible=false) at kernel/qwidget.cpp:8057
#17 0x0000000800afc953 in QDockAreaLayoutInfo::restoreState (this=0x8036cb380, stream=..., widgets=..., testing=false) at widgets/qdockarealayout.cpp:1951
#18 0x0000000800afdb54 in QDockAreaLayout::restoreState (this=0x8036cb340, stream=..., _dockwidgets=..., testing=false) at widgets/qdockarealayout.cpp:2344
#19 0x0000000800b44703 in QMainWindowLayoutState::restoreState (this=0x8036cb268, _stream=..., oldState=...) at widgets/qmainwindowlayout.cpp:1189
#20 0x0000000800b4b497 in QMainWindowLayout::restoreState (this=0x8036cb200, stream=...) at widgets/qmainwindowlayout.cpp:2772
#21 0x0000000800b3d894 in QMainWindow::restoreState (this=0x803683c80, state=..., version=0) at widgets/qmainwindow.cpp:1296
#22 0x0000000000241af3 in MainWindow::MainWindow (this=0x803683c80, cfg=..., dropMode=false, parent=0x0, f=...) at /usr/ports/x11/qterminal/work/qterminal-1.1.0/src/mainwindow.cpp:123
#23 0x000000000023e006 in QTerminalApp::newWindow (this=0x80361a940, dropMode=false, cfg=...) at /usr/ports/x11/qterminal/work/qterminal-1.1.0/src/main.cpp:222
#24 0x000000000023d746 in main (argc=1, argv=0x7fffffffe780) at /usr/ports/x11/qterminal/work/qterminal-1.1.0/src/main.cpp:202
--- src/mainwindow.cpp.orig	2022-09-06 14:19:22 UTC
+++ src/mainwindow.cpp
@@ -869,7 +869,7 @@ void MainWindow::bookmarksWidget_callCommand(const QSt
 void MainWindow::bookmarksDock_visibilityChanged(bool visible)
 {
     Properties::Instance()->bookmarksVisible = visible;
-    if (!visible
+    if (!visible && consoleTabulator->terminalHolder() 
         && consoleTabulator->terminalHolder()->currentTerminal()->focusProxy() != nullptr)
     { // this is especially needed in the drop-down mode
         consoleTabulator->terminalHolder()->currentTerminal()->setFocus();

I have not tested if this is a FreeBSD only thing.
qterminal --version 1.1.0

@tsujan
Copy link
Member

tsujan commented Sep 6, 2022

Your extra condition seems reasonable. If it fixes the issue, why not making a PR?

jsm222 added a commit to jsm222/qterminal that referenced this issue Sep 6, 2022
When using global menus MainWindow::bookmarksDock_visibilityChanged
is called early while consoleTabulator->terminalHolder() is null.
Fix by adding a check for that condition. Fixes lxqt#992
yan12125 pushed a commit that referenced this issue Sep 11, 2022
When using global menus MainWindow::bookmarksDock_visibilityChanged
is called early while consoleTabulator->terminalHolder() is null.
Fix by adding a check for that condition. Fixes #992
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants