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

ActiveQt - SafeArray wrapped in QVariant not released correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.5.3
    • Active Qt
    • None
    • Windows

      When COM/DCOM component returns an array in VARIANT, ActiveQt component unwraps it correctly and subsequently calls VariantClear WinAPI function to release the resources. Although this works correctly for most of data types returned in VARIANT, it does not in case of the arrays.

      When an array is wrapped in VARIANT type, a SafeArray functions shall be used. Especially, calling VariantClear function will result an error stating that the data type is invalid. Here, Instead of VariantClear(), SafeArrayDestroy() shall be used:

       

      SAFEARRAY *lpSA = V_ARRAY(variant);
      [...]
      ... work with array...
      [...]
      SafeArrayDestroy(lpSA);

       

      Not doing so will cause huge memory leak (in my case about 50MB per second, as I was calling a COM method returning large amount of data). I have noticed it in Qt6.5.3 LTS although other versions might be affected too.

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

            owolff Oliver Wolff
            meehow Michal Schulz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes