Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.4.1, 5.5.1
-
None
-
-
61d990da967d10d15cd8b73d0bee9f36387f8278 (qt/qtbase/5.12)
Description
I am not sure whether dbus is a hard dependency for Qt on linux or not, but it looks like QDBusConnection::connectToBus(), which is called in the QDBusConnection constructor, is designed to deal with those cases:
QDBusConnection QDBusConnection::connectToBus(BusType type, const QString &name) { // Q_ASSERT_X(QCoreApplication::instance(), "QDBusConnection::addConnection", // "Cannot create connection without a Q[Core]Application instance"); if (!qdbus_loadLibDBus()) { QDBusConnectionPrivate *d = 0; return QDBusConnection(d); }
Alas, a little bit later, Qt applications will still crash with a segfault in the very same constructor:
DBusConnection::DBusConnection(QObject *parent) : QObject(parent), m_a11yConnection(QString()), m_enabled(false) { // Start monitoring if "org.a11y.Bus" is registered as DBus service. QDBusConnection c = QDBusConnection::sessionBus(); dbusWatcher = new QDBusServiceWatcher(A11Y_SERVICE, c, QDBusServiceWatcher::WatchForRegistration, this); connect(dbusWatcher, SIGNAL(serviceRegistered(QString)), this, SLOT(serviceRegistered())); // If it is registered already, setup a11y right away if (c.interface()->isServiceRegistered(A11Y_SERVICE)) // <--------- HERE serviceRegistered(); }
For information, here's the stack trace:
Program received signal SIGSEGV, Segmentation fault. 0xf631306e in QT::QScopedPointer<QT::QObjectData, QT::QScopedPointerDeleter<QT::QObjectData> >::data (this=0x4) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:135 135 return d; (gdb) bt #0 0xf631306e in QT::QScopedPointer<QT::QObjectData, QT::QScopedPointerDeleter<QT::QObjectData> >::data (this=0x4) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:135 #1 0xf6312953 in QT::qGetPtrHelper<QT::QScopedPointer<QT::QObjectData, QT::QScopedPointerDeleter<QT::QObjectData> > > (p=...) at ../../include/QtCore/../../src/corelib/global/qglobal.h:983 #2 0xf6312c26 in QT::QDBusAbstractInterface::d_func (this=0x0) at qdbusabstractinterface.h:148 Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name': #3 0xf631190f in QT::QDBusAbstractInterface::callWithArgumentList (this=0x0, mode=QT::QDBus::AutoDetect, method="NameHasOwner", args=) at qdbusabstractinterface.cpp:439 Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name': #4 0xf6312792 in QT::QDBusAbstractInterface::internalConstCall (this=0x0, mode=QT::QDBus::AutoDetect, method="NameHasOwner", args=) at qdbusabstractinterface.cpp:816 #5 0xf62f069e in QT::QDBusConnectionInterface::isServiceRegistered (this=0x0, serviceName="org.a11y.Bus") at qdbusconnectioninterface.cpp:202 #6 0xf655d65a in QT::DBusConnection::DBusConnection (this=0x80a34f8, parent=0x0) at linuxaccessibility/dbusconnection.cpp:66 #7 0xf6550f2a in QT::QSpiAccessibleBridge::QSpiAccessibleBridge (this=0x818b4c8) at linuxaccessibility/bridge.cpp:60 #8 0xf64b8f31 in QT::QXcbIntegration::accessibility (this=0x8061070) at qxcbintegration.cpp:316 #9 0xf74f9e0c in QT::platformAccessibility () at accessible/qaccessible.cpp:480 #10 0xf74fa599 in QT::QAccessible::isActive () at accessible/qaccessible.cpp:783 #11 0xf74fa6a9 in QT::QAccessible::updateAccessibility (event=0xffffbe50) at accessible/qaccessible.cpp:850 #12 0xf7bae778 in QT::QAbstractButton::setText (this=0x8182de8, text="New") at widgets/qabstractbutton.cpp:650 #13 0xf7ca7d73 in QT::QToolButton::setDefaultAction (this=0x8182de8, action=0x81bf2d8) at widgets/qtoolbutton.cpp:905 #14 0xf7ca1698 in QT::QToolBarLayout::createItem (this=0x80a15f0, action=0x81bf2d8) at widgets/qtoolbarlayout.cpp:728 #15 0xf7c9f416 in QT::QToolBarLayout::insertAction (this=0x80a15f0, index=0, action=0x81bf2d8) at widgets/qtoolbarlayout.cpp:194 #16 0xf7c9ce50 in QT::QToolBar::actionEvent (this=0x81c34b0, event=0xffffc728) at widgets/qtoolbar.cpp:931 #17 0xf7aae963 in QT::QWidget::event (this=0x81c34b0, event=0xffffc728) at kernel/qwidget.cpp:9044 #18 0xf7c9d719 in QT::QToolBar::event (this=0x81c34b0, event=0xffffc728) at widgets/qtoolbar.cpp:1144 #19 0xf7a5f71e in QT::QApplicationPrivate::notify_helper (this=0x8056458, receiver=0x81c34b0, e=0xffffc728) at kernel/qapplication.cpp:3716 #20 0xf7a5f595 in QT::QApplication::notify (this=0xffffc8a0, receiver=0x81c34b0, e=0xffffc728) at kernel/qapplication.cpp:3681 #21 0xf707046d in QT::QCoreApplication::notifyInternal (this=0xffffc8a0, receiver=0x81c34b0, event=0xffffc728) at kernel/qcoreapplication.cpp:965 #22 0xf7a4fc6b in QT::QCoreApplication::sendEvent (receiver=0x81c34b0, event=0xffffc728) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:224 #23 0xf7a9fbaf in QT::QWidget::insertAction (this=0x81c34b0, before=0x0, action=0x81bf2d8) at kernel/qwidget.cpp:3283 #24 0xf7a9f9ec in QT::QWidget::addAction (this=0x81c34b0, action=0x81bf2d8) at kernel/qwidget.cpp:3234 #25 0x0804e27a in MainWindow::createToolBars (this=0xffffc83c) at mainwindow.cpp:273 #26 0x0804c613 in MainWindow::MainWindow (this=0xffffc83c) at mainwindow.cpp:56 #27 0x0804c1f9 in main (argc=1, argv=0xffffc964) at main.cpp:53
—
Again, it's unclear to me whether libdbus is supposed to be a hard dependency or not when running on Linux, but even if it is, perhaps Qt could then output a message to the console and exit()?