From 1ba2e78f4d70534ae6fdcf2dfb61d4e1c2a9dd1d Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 2 Jan 2026 16:56:58 +0400 Subject: [PATCH] Make DeadlockDetector an experimental setting. --- Telegram/SourceFiles/core/sandbox.cpp | 17 ++++++++++++++--- Telegram/SourceFiles/core/sandbox.h | 2 ++ .../settings/settings_experimental.cpp | 2 ++ Telegram/SourceFiles/window/main_window.cpp | 2 +- Telegram/lib_webview | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp index 4f8c65e98f..81ea4e4906 100644 --- a/Telegram/SourceFiles/core/sandbox.cpp +++ b/Telegram/SourceFiles/core/sandbox.cpp @@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/timer.h" #include "base/concurrent_timer.h" #include "base/invoke_queued.h" +#include "base/options.h" #include "base/qthelp_url.h" #include "base/qthelp_regex.h" #include "ui/ui_utility.h" @@ -35,6 +36,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include namespace Core { +namespace { + +base::options::toggle OptionDeadlockDetector({ + .id = kOptionDeadlockDetector, + .name = "Deadlock Detector", + .description = "Check once every 30 seconds that main thread is still responsive.", + .restartRequired = true, +}); + +} // namespace + +const char kOptionDeadlockDetector[] = "deadlock-detector"; bool Sandbox::QuitOnStartRequested = false; @@ -149,12 +162,10 @@ void Sandbox::launchApplication() { } setupScreenScale(); -#ifndef _DEBUG - if (Logs::DebugEnabled()) { + if (OptionDeadlockDetector.value()) { using DeadlockDetector::PingThread; _deadlockDetector = std::make_unique(this); } -#endif // !_DEBUG _application = std::make_unique(); diff --git a/Telegram/SourceFiles/core/sandbox.h b/Telegram/SourceFiles/core/sandbox.h index 5dd5cea2bc..d881a9aa95 100644 --- a/Telegram/SourceFiles/core/sandbox.h +++ b/Telegram/SourceFiles/core/sandbox.h @@ -18,6 +18,8 @@ class QLockFile; namespace Core { +extern const char kOptionDeadlockDetector[]; + class UpdateChecker; class Application; diff --git a/Telegram/SourceFiles/settings/settings_experimental.cpp b/Telegram/SourceFiles/settings/settings_experimental.cpp index f4ec1479e4..d271ddd989 100644 --- a/Telegram/SourceFiles/settings/settings_experimental.cpp +++ b/Telegram/SourceFiles/settings/settings_experimental.cpp @@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/moderate_messages_box.h" #include "core/application.h" #include "core/launcher.h" +#include "core/sandbox.h" #include "chat_helpers/tabbed_panel.h" #include "dialogs/dialogs_widget.h" #include "history/history_item_components.h" @@ -163,6 +164,7 @@ void SetupExperimental( addToggle(Window::Notifications::kOptionGNotification); addToggle(Core::kOptionFreeType); addToggle(Core::kOptionSkipUrlSchemeRegister); + addToggle(Core::kOptionDeadlockDetector); addToggle(Data::kOptionExternalVideoPlayer); addToggle(Window::kOptionNewWindowsSizeAsFirst); addToggle(MTP::details::kOptionPreferIPv6); diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index b58ce7ea9c..6414d011a1 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -71,7 +71,7 @@ using Core::WindowPosition; base::options::toggle OptionNewWindowsSizeAsFirst({ .id = kOptionNewWindowsSizeAsFirst, - .name = "Adjust size of new chat windows.", + .name = "Adjust size of new chat windows", .description = "Open new windows with a size of the main window.", }); diff --git a/Telegram/lib_webview b/Telegram/lib_webview index 55ea117597..b4a0af279b 160000 --- a/Telegram/lib_webview +++ b/Telegram/lib_webview @@ -1 +1 @@ -Subproject commit 55ea11759711d377216eae6c45dad0bc49b67398 +Subproject commit b4a0af279bb55e1caeec3d5f82edae699c3ab251