Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.7.0
-
None
-
MacOSX 10.5
Ubuntu 9.10
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!
}