Hi,

I'm trying to create two Qt applications and connect them through DBus system.

The first application, the receiver, has a slot named "reload". The other application, the sender, must call this slot.

The receiver

The main.cpp:

MainWindow is a class that inherits from QMainWindow.
Qt Code:
  1. #include <QApplication>
  2. #include <QTextCodec>
  3. #include <QDBusConnection>
  4.  
  5. #include "MainWindow.hpp"
  6. #include "DBusManager.hpp"
  7.  
  8. int main(int argc, char *argv[]) {
  9. QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
  10. QApplication app(argc, argv);
  11.  
  12. MainWindow *mainWindow = new MainWindow();
  13. new DBusManager(mainWindow, &app);
  14. QDBusConnection::sessionBus().registerObject("/", &app);
  15.  
  16. mainWindow->show();
  17.  
  18. return app.exec();
  19. }
To copy to clipboard, switch view to plain text mode 

The DBusManager.hpp:
Qt Code:
  1. #ifndef COMPONENT_DBUSMANAGER
  2. #define COMPONENT_DBUSMANAGER
  3.  
  4. #include <QDBusAbstractAdaptor>
  5. #include <QApplication>
  6.  
  7. #include "MainWindow.hpp"
  8.  
  9. class DBusManager : public QDBusAbstractAdaptor {
  10. Q_OBJECT
  11. Q_CLASSINFO("D-Bus Interface", "org.simple-environment.sdesktop")
  12.  
  13. private:
  14. MainWindow *mainWindow;
  15.  
  16. public:
  17. DBusManager(MainWindow *mainWindow, QApplication *parent);
  18.  
  19. public slots:
  20. Q_NOREPLY void reload();
  21. };
  22.  
  23. #endif
To copy to clipboard, switch view to plain text mode 

The DBusManager.cpp:
Qt Code:
  1. #include "DBusManager.hpp"
  2.  
  3. /* Constructor */
  4.  
  5. DBusManager::DBusManager(MainWindow *mainWindow, QApplication *parent) : QDBusAbstractAdaptor(parent) {
  6. this->mainWindow = mainWindow;
  7. }
  8.  
  9. /* Public slots */
  10.  
  11. void DBusManager::reload() {
  12. this->mainWindow->reload();
  13. }
To copy to clipboard, switch view to plain text mode 

The sender

The sender, executes this code:
Qt Code:
  1. QDBusMessage message = QDBusMessage::createMethodCall("org.simple-environment.sdesktop", "/", "sdesktop", "reload");
  2. QDBusConnection::sessionBus().call(message);
To copy to clipboard, switch view to plain text mode 

I can compile both applications without problems, but when I execute them, the sender writes this through stderr:
process 14899: arguments to dbus_message_new_method_call() were incorrect, assertion "interface == NULL || _dbus_check_is_valid_interface (interface)" failed in file dbus-message.c line 1076.
This is normally a bug in some application using the D-Bus library.
QDBusConnection: error: could not send message to service "org.simple-environment.sdesktop" path "/" interface "sdesktop" member "reload"
What is wrong with this code?