Make DeadlockDetector an experimental setting.

This commit is contained in:
John Preston
2026-01-02 16:56:58 +04:00
parent d8a3df644b
commit 1ba2e78f4d
5 changed files with 20 additions and 5 deletions
+14 -3
View File
@@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/timer.h" #include "base/timer.h"
#include "base/concurrent_timer.h" #include "base/concurrent_timer.h"
#include "base/invoke_queued.h" #include "base/invoke_queued.h"
#include "base/options.h"
#include "base/qthelp_url.h" #include "base/qthelp_url.h"
#include "base/qthelp_regex.h" #include "base/qthelp_regex.h"
#include "ui/ui_utility.h" #include "ui/ui_utility.h"
@@ -35,6 +36,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtGui/qpa/qplatformscreen.h> #include <QtGui/qpa/qplatformscreen.h>
namespace Core { 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; bool Sandbox::QuitOnStartRequested = false;
@@ -149,12 +162,10 @@ void Sandbox::launchApplication() {
} }
setupScreenScale(); setupScreenScale();
#ifndef _DEBUG if (OptionDeadlockDetector.value()) {
if (Logs::DebugEnabled()) {
using DeadlockDetector::PingThread; using DeadlockDetector::PingThread;
_deadlockDetector = std::make_unique<PingThread>(this); _deadlockDetector = std::make_unique<PingThread>(this);
} }
#endif // !_DEBUG
_application = std::make_unique<Application>(); _application = std::make_unique<Application>();
+2
View File
@@ -18,6 +18,8 @@ class QLockFile;
namespace Core { namespace Core {
extern const char kOptionDeadlockDetector[];
class UpdateChecker; class UpdateChecker;
class Application; class Application;
@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/moderate_messages_box.h" #include "boxes/moderate_messages_box.h"
#include "core/application.h" #include "core/application.h"
#include "core/launcher.h" #include "core/launcher.h"
#include "core/sandbox.h"
#include "chat_helpers/tabbed_panel.h" #include "chat_helpers/tabbed_panel.h"
#include "dialogs/dialogs_widget.h" #include "dialogs/dialogs_widget.h"
#include "history/history_item_components.h" #include "history/history_item_components.h"
@@ -163,6 +164,7 @@ void SetupExperimental(
addToggle(Window::Notifications::kOptionGNotification); addToggle(Window::Notifications::kOptionGNotification);
addToggle(Core::kOptionFreeType); addToggle(Core::kOptionFreeType);
addToggle(Core::kOptionSkipUrlSchemeRegister); addToggle(Core::kOptionSkipUrlSchemeRegister);
addToggle(Core::kOptionDeadlockDetector);
addToggle(Data::kOptionExternalVideoPlayer); addToggle(Data::kOptionExternalVideoPlayer);
addToggle(Window::kOptionNewWindowsSizeAsFirst); addToggle(Window::kOptionNewWindowsSizeAsFirst);
addToggle(MTP::details::kOptionPreferIPv6); addToggle(MTP::details::kOptionPreferIPv6);
+1 -1
View File
@@ -71,7 +71,7 @@ using Core::WindowPosition;
base::options::toggle OptionNewWindowsSizeAsFirst({ base::options::toggle OptionNewWindowsSizeAsFirst({
.id = kOptionNewWindowsSizeAsFirst, .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.", .description = "Open new windows with a size of the main window.",
}); });