diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index eaad0ce2e2..ccedc4e523 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -509,7 +509,7 @@ void MainWindow::initHook() { _sniDBusProxy, "g-signal", G_CALLBACK(sniSignalEmitted), - this); + nullptr); auto sniWatcher = new QDBusServiceWatcher( kSNIWatcherService.utf16(), @@ -655,9 +655,13 @@ void MainWindow::sniSignalEmitted( gchar *sender_name, gchar *signal_name, GVariant *parameters, - MainWindow *window) { + gpointer user_data) { if(signal_name == qstr("StatusNotifierHostRegistered")) { - window->handleSNIHostRegistered(); + crl::on_main([] { + if (const auto window = App::wnd()) { + window->handleSNIHostRegistered(); + } + }); } } diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.h b/Telegram/SourceFiles/platform/linux/main_window_linux.h index a390893265..5dfb5eb8a1 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.h +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.h @@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +typedef void* gpointer; typedef char gchar; typedef struct _GVariant GVariant; typedef struct _GDBusProxy GDBusProxy; @@ -145,7 +146,7 @@ private: gchar *sender_name, gchar *signal_name, GVariant *parameters, - MainWindow *window); + gpointer user_data); #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION };