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

QWindowsSystemTrayIcon::showMessage: Windows Handle leak

XMLWordPrintable

    • Windows
    • afb74a86d (dev), 59ff87dc9 (6.7), 5bdb2bace (6.6), fd5487188 (tqtc/lts-6.5), 65a49b6bd (tqtc/lts-6.2), c4b785ab9 (tqtc/lts-5.15)

      Hi,

      it looks like that the function

      QWindowsSystemTrayIcon::showMessage

      has a severe handle leak.

      tnd.hBalloonIcon = qt_pixmapToWinHICON(pm);

      The icon should get released after displaying the notification.

      After ~10000 calls all handles are allocated and the program crashes.

      Regards

      Alex

       

       

       

      QPixmap pm = icon.pixmap(size);
      if (pm.isNull())

      { tnd.dwInfoFlags = NIIF_INFO; }

      else {
      if (pm.size() != size)

      { qWarning("QSystemTrayIcon::showMessage: Wrong icon size (%dx%d), please add standard one: %dx%d", pm.size().width(), pm.size().height(), size.width(), size.height()); pm = pm.scaled(size, Qt::IgnoreAspectRatio); }

      tnd.hBalloonIcon = qt_pixmapToWinHICON(pm);
      }
      tnd.hWnd = m_hwnd;
      tnd.uTimeout = msecsIn <= 0 ? UINT(10000) : UINT(msecsIn); // 10s default
      tnd.uFlags = NIF_INFO | NIF_SHOWTIP;

      Shell_NotifyIcon(NIM_MODIFY, &tnd);

      // RELEASE the icon...

       

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

            vhilshei Volker Hilsheimer
            datacube Alexander Golde
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes