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

Crash in KDDockWidgets::DockWidgetInstantiator::isFocusedChanged #501

Closed
msarehn opened this issue Apr 30, 2024 · 4 comments
Closed

Crash in KDDockWidgets::DockWidgetInstantiator::isFocusedChanged #501

msarehn opened this issue Apr 30, 2024 · 4 comments

Comments

@msarehn
Copy link

msarehn commented Apr 30, 2024

Sometimes, although not reliably, KDDockWidgets (QtQuick backend) crashes when closing a DockWidget.

We've already had similar crashes before with 2.0. We've bumped to 2.1-dev because it includes b7db57c (Do not emit isFocusedChanged in a delayed manner) which improves the situation a little bit, but does not get rid of the crashes completely.

FWIW, we do have a commercial license for KDDW.

Details

Version: 2.1-dev commit 497f65f

Backtrace
Thread 1 "coreui" received signal SIGSEGV, Segmentation fault.
0x00007ffff2824dc1 in QObjectPrivate::maybeSignalConnected(unsigned int) const () from /opt/qt6/lib/libQt6Core.so.6
(gdb) bt
#0  0x00007ffff2824dc1 in QObjectPrivate::maybeSignalConnected(unsigned int) const () from /opt/qt6/lib/libQt6Core.so.6
#1  0x00007ffff2834ca8 in void doActivate<false>(QObject*, int, void**) () from /opt/qt6/lib/libQt6Core.so.6
#2  0x00007ffff6eb4f6e in KDDockWidgets::DockWidgetInstantiator::isFocusedChanged (this=0x5555563e7230, _t1=false)
    at /home/arehn/src/build-dcf-ecosystem-Menlo_Qt6_6_6_0-Debug/coreui/3rdparty/KDDockWidgets/src/kddockwidgets_autogen/5PJCAAPZ7B/moc_DockWidgetInstantiator.cpp:812
#3  0x00007ffff737b772 in KDDockWidgets::DockWidgetInstantiator::<lambda(bool)>::operator()(bool) const (__closure=0x555556251ea0, is=false)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/qtquick/DockWidgetInstantiator.cpp:228
#4  0x00007ffff73809b5 in std::_Function_handler<void(bool), KDDockWidgets::DockWidgetInstantiator::componentComplete()::<lambda(bool)> >::_M_invoke(const std::_Any_data &, bool &&) (__functor=..., __args#0=@0x7fffffffc524: false) at /usr/include/c++/9/bits/std_function.h:300
#5  0x00007ffff6f0ed38 in std::function<void (bool)>::operator()(bool) const (this=0x555556251ea0, __args#0=false)
    at /usr/include/c++/9/bits/std_function.h:688
#6  0x00007ffff6f0e4cd in KDBindings::Signal<bool>::Impl::emit (this=0x5555562519b0, p#0=false)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/3rdparty/kdbindings/signal.h:301
#7  0x00007ffff6f0e00b in KDBindings::Signal<bool>::emit (this=0x55555624d940, p#0=false)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/3rdparty/kdbindings/signal.h:494
#8  0x00007ffff7085b1d in KDDockWidgets::DockRegistry::setFocusedDockWidget (this=0x5555556b1bc0, dw=0x0)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/core/DockRegistry.cpp:123
#9  0x00007ffff70857db in KDDockWidgets::DockRegistry::onFocusedViewChanged (this=0x5555556b1bc0, view=
    std::shared_ptr<class KDDockWidgets::Core::View> (use count 3, weak count 1) = {...})
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/core/DockRegistry.cpp:111
#10 0x00007ffff70c1743 in std::__invoke_impl<void, void (KDDockWidgets::DockRegistry::*&)(std::shared_ptr<KDDockWidgets::Core::View>), KDDockWidgets::DockRegistry*&, std::shared_ptr<KDDockWidgets::Core::View> > (__f=
    @0x5555556b1e30: (void (KDDockWidgets::DockRegistry::*)(class KDDockWidgets::DockRegistry * const, class std::shared_ptr<KDDockWidgets::Core::View>)) 0x7ffff708547a <KDDockWidgets::DockRegistry::onFocusedViewChanged(std::shared_ptr<KDDockWidgets::Core::View>)>,
    __t=@0x5555556b1e40: 0x5555556b1bc0) at /usr/include/c++/9/bits/invoke.h:73
#11 0x00007ffff70b9bed in std::__invoke<void (KDDockWidgets::DockRegistry::*&)(std::shared_ptr<KDDockWidgets::Core::View>), KDDockWidgets::DockRegistry*&, std::shared_ptr<KDDockWidgets::Core::View> > (__fn=
    @0x5555556b1e30: (void (KDDockWidgets::DockRegistry::*)(class KDDockWidgets::DockRegistry * const, class std::shared_ptr<KDDockWidgets::Core::View>)) 0x7ffff708547a <KDDockWidgets::DockRegistry::onFocusedViewChanged(std::shared_ptr<KDDockWidgets::Core::View>)>)
    at /usr/include/c++/9/bits/invoke.h:95
#12 0x00007ffff70affcf in std::_Bind<void (KDDockWidgets::DockRegistry::*(KDDockWidgets::DockRegistry*, KDBindings::Private::placeholder<1>))(std::shared_ptr<KDDockWidgets::Core::View>)>::__call<void, std::shared_ptr<KDDockWidgets::Core::View>&&, 0ul, 1ul>(std::tuple<std::shared_ptr<KDDockWidgets::Core::View>&&>&&, std::_Index_tuple<0ul, 1ul>) (this=0x5555556b1e30, __args=...) at /usr/include/c++/9/functional:400
#13 0x00007ffff70a584b in std::_Bind<void (KDDockWidgets::DockRegistry::*(KDDockWidgets::DockRegistry*, KDBindings::Private::placeholder<1>))(std::shared_ptr<KDDockWidgets::Core::View>)>::operator()<std::shared_ptr<KDDockWidgets::Core::View>, void>(std::shared_ptr<KDDockWidgets::Core::View>&&) (this=0x5555556b1e30) at /usr/include/c++/9/functional:484
#14 0x00007ffff709ec5a in std::_Function_handler<void (std::shared_ptr<KDDockWidgets::Core::View>), std::_Bind<void (KDDockWidgets::DockRegistry::*(KDDockWidgets::DockRegistry*, KDBindings::Private::placeholder<1>))(std::shared_ptr<KDDockWidgets::Core::View>)> >::_M_invoke(std::_Any_data const&, std::shared_ptr<KDDockWidgets::Core::View>&&) (__functor=..., __args#0=...) at /usr/include/c++/9/bits/std_function.h:300
#15 0x00007ffff72a7bf5 in std::function<void (std::shared_ptr<KDDockWidgets::Core::View>)>::operator()(std::shared_ptr<KDDockWidgets::Core::View>) const (this=0x555555ba67e8, __args#0=std::shared_ptr<class KDDockWidgets::Core::View> (empty) = {...})
    at /usr/include/c++/9/bits/std_function.h:688
--Type <RET> for more, q to quit, c to continue without paging--
#16 0x00007ffff72a78e2 in KDBindings::Signal<std::shared_ptr<KDDockWidgets::Core::View> >::Impl::emit (this=0x5555556b1dd0,
    p#0=std::shared_ptr<class KDDockWidgets::Core::View> (use count 3, weak count 1) = {...})
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/3rdparty/kdbindings/signal.h:301
#17 0x00007ffff72a74e9 in KDBindings::Signal<std::shared_ptr<KDDockWidgets::Core::View> >::emit (this=0x5555556b1920,
    p#0=std::shared_ptr<class KDDockWidgets::Core::View> (use count 3, weak count 1) = {...})
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/3rdparty/kdbindings/signal.h:494
#18 0x00007ffff736d313 in KDDockWidgets::QtQuick::Platform::<lambda(QObject*)>::operator()(QObject *) const (__closure=0x5555556b50a0,
    obj=0x5555556f1680) at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/qtquick/Platform.cpp:90
#19 0x00007ffff736f715 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QObject*>, void, KDDockWidgets::QtQuick::Platform::init()::<lambda(QObject*)> >::call(KDDockWidgets::QtQuick::Platform::<lambda(QObject*)> &, void **) (f=..., arg=0x7fffffffcb40)
    at /opt/qt6/include/QtCore/qobjectdefs_impl.h:137
#20 0x00007ffff736f64b in QtPrivate::Functor<KDDockWidgets::QtQuick::Platform::init()::<lambda(QObject*)>, 1>::call<QtPrivate::List<QObject*>, void>(KDDockWidgets::QtQuick::Platform::<lambda(QObject*)> &, void *, void **) (f=..., arg=0x7fffffffcb40)
    at /opt/qt6/include/QtCore/qobjectdefs_impl.h:339
#21 0x00007ffff736f5b6 in QtPrivate::QCallableObject<KDDockWidgets::QtQuick::Platform::init()::<lambda(QObject*)>, QtPrivate::List<QObject*>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x5555556b5090, r=0x5555555b10d0, a=0x7fffffffcb40,
    ret=0x0) at /opt/qt6/include/QtCore/qobjectdefs_impl.h:522
#22 0x00007ffff2834df3 in void doActivate<false>(QObject*, int, void**) () from /opt/qt6/lib/libQt6Core.so.6
#23 0x00007ffff2f2feb6 in QGuiApplication::focusObjectChanged(QObject*) () from /opt/qt6/lib/libQt6Gui.so.6
#24 0x00007ffff2f397d2 in QGuiApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /opt/qt6/lib/libQt6Gui.so.6
#25 0x00007ffff2835177 in void doActivate<false>(QObject*, int, void**) () from /opt/qt6/lib/libQt6Core.so.6
#26 0x00007ffff2f92b96 in QWindow::focusObjectChanged(QObject*) () from /opt/qt6/lib/libQt6Gui.so.6
#27 0x00007ffff1e09ab6 in QQuickDeliveryAgentPrivate::clearFocusInScope(QQuickItem*, QQuickItem*, Qt::FocusReason, QFlags<QQuickDeliveryAgentPrivate::FocusOption>) () from /opt/qt6/lib/libQt6Quick.so.6
#28 0x00007ffff1c66463 in QQuickItem::setParentItem(QQuickItem*) () from /opt/qt6/lib/libQt6Quick.so.6
#29 0x00007ffff1c67343 in QQuickItem::~QQuickItem() () from /opt/qt6/lib/libQt6Quick.so.6
#30 0x00007ffff6ef3cf7 in KDDockWidgets::QtQuick::View::~View (this=0x555556280d10, __in_chrg=<optimized out>)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/qtquick/views/View.h:67
#31 0x00007ffff739a654 in KDDockWidgets::QtQuick::Group::~Group (this=0x555556280d10, __in_chrg=<optimized out>)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/qtquick/views/Group.cpp:66
#32 0x00007ffff739a6c4 in KDDockWidgets::QtQuick::Group::~Group (this=0x555556280d10, __in_chrg=<optimized out>)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/qtquick/views/Group.cpp:75
#33 0x00007ffff71fc62d in KDDockWidgets::Core::View::Private::free (this=0x5555563e43c0)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/core/View.cpp:100
#34 0x00007ffff71ef037 in KDDockWidgets::Core::Controller::~Controller (this=0x555555ba2fa0, __in_chrg=<optimized out>)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/core/Controller.cpp:37
#35 0x00007ffff7142fcc in KDDockWidgets::Core::Group::~Group (this=0x555555ba2fa0, __in_chrg=<optimized out>)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/core/Group.cpp:117
#36 0x00007ffff7143024 in KDDockWidgets::Core::Group::~Group (this=0x555555ba2fa0, __in_chrg=<optimized out>)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/core/Group.cpp:134
#37 0x00007ffff740abb3 in KDDockWidgets::Core::DelayedDelete::call (this=0x55555637fe40)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/core/DelayedCall.cpp:41
--Type <RET> for more, q to quit, c to continue without paging--
#38 0x00007ffff73ef037 in KDDockWidgets::QtCommon::Platform_qt::<lambda()>::operator()(void) const (__closure=0x5555560e2760)
    at /home/arehn/src/dcf-ecosystem/coreui/3rdparty/KDDockWidgets/src/qtcommon/Platform.cpp:330
#39 0x00007ffff73efbe2 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, KDDockWidgets::QtCommon::Platform_qt::runDelayed(int, KDDockWidgets::Core::DelayedCall*)::<lambda()> >::call(KDDockWidgets::QtCommon::Platform_qt::<lambda()> &, void **) (f=...,
    arg=0x555556bd72b8) at /opt/qt6/include/QtCore/qobjectdefs_impl.h:137
#40 0x00007ffff73efb8f in QtPrivate::Functor<KDDockWidgets::QtCommon::Platform_qt::runDelayed(int, KDDockWidgets::Core::DelayedCall*)::<lambda()>, 0>::call<QtPrivate::List<>, void>(KDDockWidgets::QtCommon::Platform_qt::<lambda()> &, void *, void **) (f=..., arg=0x555556bd72b8)
    at /opt/qt6/include/QtCore/qobjectdefs_impl.h:339
#41 0x00007ffff73efafa in QtPrivate::QCallableObject<KDDockWidgets::QtCommon::Platform_qt::runDelayed(int, KDDockWidgets::Core::DelayedCall*)::<lambda()>, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x5555560e2750,
    r=0x5555555b10d0, a=0x555556bd72b8, ret=0x0) at /opt/qt6/include/QtCore/qobjectdefs_impl.h:522
#42 0x00007ffff282696b in QObject::event(QEvent*) () from /opt/qt6/lib/libQt6Core.so.6
#43 0x00007ffff2f3cf13 in QGuiApplication::event(QEvent*) () from /opt/qt6/lib/libQt6Gui.so.6
#44 0x00007ffff27d645a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /opt/qt6/lib/libQt6Core.so.6
#45 0x00007ffff27d9e35 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /opt/qt6/lib/libQt6Core.so.6
#46 0x00007ffff2a8e2e7 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /opt/qt6/lib/libQt6Core.so.6
#47 0x00007ffff00b317d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#48 0x00007ffff00b3400 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#49 0x00007ffff00b34a3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#50 0x00007ffff2a8dbe8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/qt6/lib/libQt6Core.so.6
#51 0x00007ffff27e1e03 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/qt6/lib/libQt6Core.so.6
#52 0x00007ffff27de3f6 in QCoreApplication::exec() () from /opt/qt6/lib/libQt6Core.so.6
#53 0x00007ffff6d62253 in guimain (args=...) at /home/arehn/src/dcf-ecosystem/coreui/src/coreui-shared.cpp:370
#54 0x0000555555563c50 in main (argc=4, argv=0x7fffffffe1a8) at /home/arehn/src/dcf-ecosystem/coreui/src/main.cpp:40
@iamsergio
Copy link
Contributor

Hi,

Is it repro with the example ./bin/qtquick_dockwidgets ?
Which flags are you passing to Config::setFlags() ?

@msarehn
Copy link
Author

msarehn commented Apr 30, 2024

Is it repro with the example ./bin/qtquick_dockwidgets ?

Nope.

Which flags are you passing to Config::setFlags() ?

None, we don't call this. Its at the default.

@iamsergio
Copy link
Contributor

iamsergio commented Apr 30, 2024

@msarehn I can't reproduce, but I understand why it happened. Should be fixed, please test latest 2.1 branch

@msarehn
Copy link
Author

msarehn commented Apr 30, 2024

@iamsergio that was quick, thanks! I was going through the code and arrived at the same solution the very moment you've pushed the fix.

Works as intendend, doesn't crash anymore 👍

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

No branches or pull requests

2 participants