Skip to content

Commit

Permalink
Fix for #914 GUI crash when no system notificator is available (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxaddict authored Jan 23, 2022
1 parent 1b4d407 commit 444208e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/qt/navcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ NavcoinGUI::NavcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
if (QSystemTrayIcon::isSystemTrayAvailable()) {
createTrayIcon(networkStyle);
}
notificator = new Notificator(QApplication::applicationName(), trayIcon, this);

// Create status bar
statusBar();
Expand Down Expand Up @@ -1224,14 +1225,12 @@ void NavcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
assert(QSystemTrayIcon::isSystemTrayAvailable());

#ifndef Q_OS_MAC
trayIcon = new QSystemTrayIcon(this);
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
trayIcon->setToolTip(toolTip);
trayIcon->setIcon(networkStyle->getTrayAndWindowIcon());
trayIcon->hide();
if (QSystemTrayIcon::isSystemTrayAvailable()) {
trayIcon = new QSystemTrayIcon(networkStyle->getTrayAndWindowIcon(), this);
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
trayIcon->setToolTip(toolTip);
}
#endif

notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
}

void NavcoinGUI::createTrayIconMenu()
Expand Down Expand Up @@ -1670,9 +1669,9 @@ void NavcoinGUI::message(const QString &title, const QString &message, unsigned
int r = mBox.exec();
if (ret != nullptr)
*ret = r == QMessageBox::Ok;
} else {
notificator->notify(static_cast<Notificator::Class>(nNotifyIcon), strTitle, message);
}
else
notificator->notify((Notificator::Class)nNotifyIcon, strTitle, message);
}

void NavcoinGUI::changeEvent(QEvent *e)
Expand Down

0 comments on commit 444208e

Please sign in to comment.