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

QList's inline use of new and delete can cause memory errors

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.3.0 Alpha
    • None

      QList uses inline new and delete which can cause memory problems, especially when linking dynamically to Qt. There's a discussion here about the actual problem, please see the last few comments: QTBUG-7884

      This bug allows objects to be created on one side of the DLL boundary (Qt libs) but destroyed on the other (linked main program). As noted in QTBUG-7884, if a program that links to Qt defines its own allocators, there can be a mismatch of memory handlers, resulting in Qt handling the new, but a user-defined allocator handling the delete.

      Besides the inherent riskiness of de/allocating memory across DLL boundaries, many Qt users (my company included) redefine their own new and delete operators. This can cause very hard to find errors when dynamically linking against Qt. The following bug might be caused by the same issue: QTBUG-18904

        1. listProblem.zip
          2 kB
          Alex Montgomery
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            apmontgo Alex Montgomery
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes