mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Main thread deadlock detector for debug mode
This commit is contained in:
@@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "core/launcher.h"
|
||||
#include "core/local_url_handlers.h"
|
||||
#include "core/update_checker.h"
|
||||
#include "core/deadlock_detector.h"
|
||||
#include "base/timer.h"
|
||||
#include "base/concurrent_timer.h"
|
||||
#include "base/invoke_queued.h"
|
||||
@@ -198,6 +199,13 @@ void Sandbox::launchApplication() {
|
||||
}
|
||||
setupScreenScale();
|
||||
|
||||
#ifndef _DEBUG
|
||||
if (Logs::DebugEnabled()) {
|
||||
using DeadlockDetector::PingThread;
|
||||
_deadlockDetector = std::make_unique<PingThread>(this);
|
||||
}
|
||||
#endif // !_DEBUG
|
||||
|
||||
_application = std::make_unique<Application>();
|
||||
|
||||
// Ideally this should go to constructor.
|
||||
@@ -267,6 +275,10 @@ bool Sandbox::event(QEvent *e) {
|
||||
return false;
|
||||
} else if (e->type() == QEvent::Close) {
|
||||
Quit();
|
||||
} else if (e->type() == DeadlockDetector::PingPongEvent::Type()) {
|
||||
postEvent(
|
||||
static_cast<DeadlockDetector::PingPongEvent*>(e)->sender(),
|
||||
new DeadlockDetector::PingPongEvent(this));
|
||||
}
|
||||
return QApplication::event(e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user