Try fixing crashes on Linux.

This commit is contained in:
John Preston 2025-03-10 13:32:36 +04:00
parent f024ceecdd
commit 11d0f9db03

View file

@ -423,7 +423,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) {
Core::Sandbox::Instance().customEnterFromEventLoop([&] { Core::Sandbox::Instance().customEnterFromEventLoop([&] {
for (const auto &[key, notifications] : _notifications) { for (const auto &[key, notifications] : _notifications) {
for (const auto &[msgId, notification] : notifications) { for (const auto &[msgId, notification] : notifications) {
if (id == v::get<uint>(notification->id)) { const auto &nid = notification->id;
if (v::is<uint>(nid) && v::get<uint>(nid) == id) {
if (actionName == "default") { if (actionName == "default") {
_manager->notificationActivated({ key, msgId }); _manager->notificationActivated({ key, msgId });
} else if (actionName == "mail-mark-read") { } else if (actionName == "mail-mark-read") {
@ -447,7 +448,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) {
Core::Sandbox::Instance().customEnterFromEventLoop([&] { Core::Sandbox::Instance().customEnterFromEventLoop([&] {
for (const auto &[key, notifications] : _notifications) { for (const auto &[key, notifications] : _notifications) {
for (const auto &[msgId, notification] : notifications) { for (const auto &[msgId, notification] : notifications) {
if (id == v::get<uint>(notification->id)) { const auto &nid = notification->id;
if (v::is<uint>(nid) && v::get<uint>(nid) == id) {
_manager->notificationReplied( _manager->notificationReplied(
{ key, msgId }, { key, msgId },
{ QString::fromStdString(text), {} }); { QString::fromStdString(text), {} });
@ -468,7 +470,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) {
std::string token) { std::string token) {
for (const auto &[key, notifications] : _notifications) { for (const auto &[key, notifications] : _notifications) {
for (const auto &[msgId, notification] : notifications) { for (const auto &[msgId, notification] : notifications) {
if (id == v::get<uint>(notification->id)) { const auto &nid = notification->id;
if (v::is<uint>(nid) && v::get<uint>(nid) == id) {
GLib::setenv("XDG_ACTIVATION_TOKEN", token, true); GLib::setenv("XDG_ACTIVATION_TOKEN", token, true);
return; return;
} }
@ -501,7 +504,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) {
* In all other cases we keep the notification reference so that we may clear the notification later from history, * In all other cases we keep the notification reference so that we may clear the notification later from history,
* if the message for that notification is read (e.g. chat is opened or read from another device). * if the message for that notification is read (e.g. chat is opened or read from another device).
*/ */
if (id == v::get<uint>(notification->id) && reason == 2) { const auto &nid = notification->id;
if (v::is<uint>(nid) && v::get<uint>(nid) == id && reason == 2) {
clearNotification({ key, msgId }); clearNotification({ key, msgId });
return; return;
} }