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

new and delete calls used in QList header (template) leading to memory allocator mismatch in client code - and crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.9.3
    • None

    Description

      Hi,

      we are facing the issue already mentionned in https://bugreports.qt.io/browse/QTBUG-37395.

      Basically, we use our own memory allocation routines, overriding the global and delete operators (common practise in game/3d industry).

      Now, since QList is a template class, some of the implementation is duplicated in Qt DLLS and client code. However, this leads to a mismatch between the new/delete functions linked in Qt DLLs and the ones linked in our client code.

      The issue is, when a QList object is created in Qt DLLs and destroyed in the client code (used quite often): memory is allocated in Qt DLL (using standard new/delete) but deallocated in our client code (using modified new/delete), leading to a crash.

      A solution would be to have all Qt-allocated memory allocated AND destroy in the same location (i.e. Qt DLL).
      Another option would be to not rely on global new/delete operator, but rather on routines that can't be overriden by users (internal Qt allocator for instance), and whose implementation is located in Qt DLL ONLY (as opposed to client code as well, which is the case at the moment).

      This is a real critical flaw as far as I am concerned...

      Thanks for reading.

      Regards,

      Gregory

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              gjaegy Gregory Jaegy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes