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

QWindowsSystemTrayIcon::showMessage: Windows Handle leak

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P1: Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.15
    • Fix Version/s: None
    • Component/s: GUI: Window management
    • Labels:
      None
    • Environment:
      Windows 10 Pro
    • Platform/s:
      Windows

      Description

      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...

       

        Attachments

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

          Activity

            People

            Assignee:
            tpochep Timur Pocheptsov
            Reporter:
            datacube Alexander Golde
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes