Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-73928

qmlcachegen generated code leaks when unloaded.

    XMLWordPrintable

Details

    • All

    Description

      Hi,

      My use case is load a library (dlopen) which is linked with code generated through qmlcachegen. when I unload the library, some resources are leaked.

      in the generated code contains :

      int QT_MANGLE_NAMESPACE(qInitResources_myresource)() {
       ::unitRegistry();
       Q_INIT_RESOURCE(qml_cache);
       return 1;
      }
      /* this calls qInitResources_myresource on dlopen, but qCleanupResources_myresource won't be called on dlclose
       */
      Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qInitResources_myresource)); 
      int QT_MANGLE_NAMESPACE(qCleanupResources_myresource)()
       {
       Q_CLEANUP_RESOURCE(qml_cache);
       return 1;
      }
      

      qrc seems to solve this issue by using a structure as :

      namespace {
         struct initializer {
             initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources_qml_cache)(); }
             ~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources_qml_cache)(); }
         } dummy;
      }
      

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            chub Pierre Lamot
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes