Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Abort at close down of app in QObject destructor

    General and Desktop
    qt5.4
    1
    1
    352
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      gbonnema last edited by

      Hello all,

      We created an application using QtQuick2. The application works (mostly) but when closing down I get an abort in the destruction of QObject for which I show the stacktrace plus main.cpp below: it is a very short stack trace.

      I have no idea how to approach debugging this, because most of the application is gone, this is AFAICS the last object being deleted.

      Anyone have an idea how to approach this? Or what might be wrong?

      #0  0x00007ffff58ea539 in QObject::~QObject() (this=0x60a278 <dataControl>, __in_chrg=<optimized out>) at kernel/qobject.cpp:924
              d = 0x912640
      #1  0x00007ffff7aaf2a4 in DataControl::~DataControl() (this=0x60a278 <dataControl>, __in_chrg=<optimized out>) at ../../xmd/xmd/datacontrol.cpp:55
      #2  0x00007ffff45bb6ea in __cxa_finalize () at /usr/lib64/libc.so.6
      #3  0x00007ffff7aa8bb3 in __do_global_dtors_aux () at /home/gbonnema/Documents/10-studie-ou/T61327-ABI-Afstudeerproject-Bachelor-Informatica/xmas/src/build-xmd-Desktop-Debug/xmdmain/../xmd/libxmd.so.1
      #4  0x00007fffffffddc0 in  ()
      #5  0x00007ffff7deb4e7 in _dl_fini () at /lib64/ld-linux-x86-64.so.2
      

      The code of main.cpp:

       * Access globals in C++ through statements like
       *
       *      "extern DataControl *dataControl;"
       *
       */
      DataControl *dataControl = nullptr;
      PluginControl *pluginControl = nullptr;
      Util *util = nullptr;
      
      int main(int argc, char *argv[])
      {
          Q_INIT_RESOURCE(quick);
          Q_INIT_RESOURCE(javascripts);
          Q_INIT_RESOURCE(images);
      
          QApplication app(argc, argv);
          QCoreApplication::setApplicationVersion(QT_VERSION_STR);
          QCoreApplication::setApplicationName("XMAS Model Designer (2015)");
          QCoreApplication::setOrganizationName("Open University NL");
          QCoreApplication::setOrganizationDomain("ou.nl");
      
          /*************************************************/
          /* OOAK class registration for Qml access        */
      
          QQmlApplicationEngine engine;
          QQmlContext* ctx = engine.rootContext();
      
          DataControl *dataControl = new DataControl();
          ::dataControl = dataControl;
          qmlRegisterType<DataControl>("XMAS", 1, 0, "Data"); // Before engine.load
          ctx->setContextProperty("datacontrol", dataControl);
      
          PluginControl *pluginControl = new PluginControl();
          ::pluginControl = pluginControl;
          qmlRegisterType<PluginControl>("XMAS", 1, 0, "Plugin"); // Before engine.load
          ctx->setContextProperty("plugincontrol", pluginControl);
      
          Util *util = new Util();
          ::util = util;
          qmlRegisterType<Util>("XMAS", 1, 0, "Util"); // Before engine.load
          ctx->setContextProperty("util", util);
      
      
          /* End of OOAK class registration for Qml access */
          /*************************************************/
      
          dataControl->registerTypes(); // Before engine.load
      
          engine.load(QUrl(QStringLiteral("qrc:/ui/mainWindow.qml")));
          return app.exec();
      
      }
      

      The destructor for DataControl is empty. Any ideas?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post