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

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

    XMLWordPrintable

Details

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

    Description

      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

      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
              apmontgo Alex Montgomery
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes