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

QSystemTrayIcon segfault on MacOSX if you hide() while in slot connected to activated()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.7.0
    • None
    • MacOSX 10.5
      Ubuntu 9.10
    • macOS

    Description

      Hello,

      When you try to hide() a QSystemTrayIcon while responding to its activated() signal, Qt segfaults on MacOSX.
      It also segfaults on ubuntu if you do a right click on the tray icon. I was able to fix the problem on ubuntu by using Qt::QueuedConnection for the connect() call, and on MacOSX my workaroud was to use QTimer::singleShot(1000, m_tray_icon, SLOT(hide())).

      Here's some code that should help you understand the problem:

      configurator::configurator(QWidget *parent) : QMainWindow(parent)
      {
      m_tray_icon = new QSystemTrayIcon(QIcon(":/icons/logo.png"), this);
      connect(m_tray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(tray_icon_clicked()));
      }

      void configurator::hideEvent(QHideEvent* event)
      {
      hide();
      m_tray_icon->show();
      QWidget::hideEvent(event);
      }

      void configurator::tray_icon_clicked()
      {
      showNormal();
      m_tray_icon->hide(); // segfaults!
      }

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            philippe.vaucher Philippe Vaucher
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes