Bug 164200 - Crash when call QDBusConnection::disconnectFromBus
Summary: Crash when call QDBusConnection::disconnectFromBus
Status: RESOLVED NOT A BUG
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: qt (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-16 09:48 UTC by Huang Peng
Modified: 2008-06-16 10:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Huang Peng 2008-06-16 09:48:13 UTC
Version:           4.3.5 (using KDE 4.0.5)
Installed from:    Fedora RPMs
OS:                Linux

Reproduce steps.
1. Call QDBusConnection::connectToBus (address, name)
2. delete the connection
3. Call QDBusConnection::disconnectFromBus
4. crash

Output:
 process 21469: Applications must not close shared connections - see dbus_connection_close() docs. This is a bug in the application.
  D-Bus not built with -rdynamic so unable to print a backtrace
Comment 1 Pino Toscano 2008-06-16 09:53:21 UTC
Did you report the bug to Trolltech? For example, using qt-bugs@trolltech.com
Comment 2 Thiago Macieira 2008-06-16 09:58:20 UTC
#include <QtDBus/QDBusConnection>
#include <QtCore/QCoreApplication>

int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    {
        QDBusConnection conn =
            QDBusConnection::connectToBus(QDBusConnection::SessionBus,
                                          "myconnection");
    }

    QDBusConnection::disconnectFromBus("myconnection");
}

No crash. If you have a testcase, please send to trolltech.
Comment 3 Huang Peng 2008-06-16 09:59:02 UTC
No. I will sent a mail to it.
FYI:
QDBusConnection::connectToBus (type, name) uses dbus_bus_get_private to create a private dbus connection (it works fine), but QDBusConnection::connectToBus (address, name) does not use dbus_connection_open_private to create a private connection. So calling disconnectFromBus will cause the crash. I think it's the reason of this bug.
Comment 4 Huang Peng 2008-06-16 10:01:16 UTC
The problem will happens, if connection is created by QDBusConnection::connectToBus (address, name).
Comment 5 Huang Peng 2008-06-16 10:03:21 UTC
Test Case:

QDBusConnection *connection = new QDBusConnection (QDBusConnection::connectToBus (getenv ("DBUS_SESSION_BUS_ADDRESS"), "dbus"));
delete connection;
QDBusConnection::disconnectFromBus ("dbus");
Comment 6 Thiago Macieira 2008-06-16 10:13:13 UTC
Report to trolltech.