Qt Forum

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

    Unsolved Component.onDestruction() causing segfault on closing applicaton

    QML and Qt Quick
    1
    1
    98
    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.
    • R
      RobM last edited by

      Hey guys, in one of my QML files I am calling a Q_INVOKABLE function whenever Component.onDestruction() occurs. This action in it of itself does not cause a seg fault. However, if I close the application while in the menu that this QML file is controlling I get a segfault here on line 163 of qjsengine_p.h:

      /*!
      Returns a QQmlPropertyCache for \a obj if one is available.
      
      If \a obj is null, being deleted or contains a dynamic meta object 0
      is returned.
      
      The returned cache is not referenced, so if it is to be stored, call addref().
      
      XXX thread There is a potential future race condition in this and all the cache()
      functions.  As the QQmlPropertyCache is returned unreferenced, when called
      from the loader thread, it is possible that the cache will have been dereferenced
      and deleted before the loader thread has a chance to use or reference it.  This
      can't currently happen as the cache holds a reference to the
      QQmlPropertyCache until the QQmlEngine is destroyed.
      */
      QQmlPropertyCache *QJSEnginePrivate::cache(QObject *obj)
      {
          if (!obj || QObjectPrivate::get(obj)->metaObject || QObjectPrivate::get(obj)->wasDeleted)
              return nullptr;
      
          Locker locker(this);
          const QMetaObject *mo = obj->metaObject();
          return QQmlMetaType::propertyCache(mo);
      }
      

      if I remove the Componenet.onDestruction() code then there is no seg fault on closing the application in that menu. Here is how I am using Component.onDestruction() in the code itself:

      id: advancedSettings
      
              title: qsTr("Advanced Settings")
      
              canOpen: true
              Component.onDestruction: presenter.configureReceiver()
      ...
      

      am I using this incorrectly?

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