Problems with Open-Source Downloads read and

isSystemTrayAvailable() always crashes (Segfault) on Ubuntu 10.10 Desktop

  • Obviously the response should have been "true", as my icon gets there on the tray area as I requested when I comment out the crash causing "isSystemTrayAvailable()", but why does it crash?

  • Can you post a code snippet, how you use it?

  • @int main(int argc, char *argv[])

        if (!QSystemTrayIcon::isSystemTrayAvailable())   <--- CRASH HERE@

  • You must construct a QApplication object first:

    The following snippet works, if you leave out the QApplication it crashes:

    int main(int argc, char *argv[])
    QApplication a(argc, argv);
    bool ok = QSystemTrayIcon::isSystemTrayAvailable();
    qDebug() << ok;

    return 0;


  • Much thanks. The interesting thing is that it works for OSX and Windows as is, but crashes on Ubuntu. Fine line there, I'll respect the rules.

  • The sys tray is always available on OS X and Windows, so the the method returns a hard coded "true".

    On Linux (resp. X11) this is not always true:

    bq. from the docs:
    The QSystemTrayIcon class can be used on the following platforms: [...] All window managers for X11 that implement the system tray specification, including recent versions of KDE and GNOME

    Some old fashioned window managers don't have it. Thus it must be determined at run time and for that the window system has to be set up before with QApplication.

Log in to reply