Description: Exclude crash reports by means of macro
 Thanks to this I do not worry about backporting eliminated code.
Forwarded: https://github.com/telegramdesktop/tdesktop/pull/16794
Author: Nicholas Guriev <guriev-ns@ya.ru>
Last-Update: Wed, 19 Nov 2025 20:01:30 +0300

--- a/Telegram/SourceFiles/core/crash_report_window.cpp
+++ b/Telegram/SourceFiles/core/crash_report_window.cpp
@@ -239,6 +239,7 @@ void NotStartedWindow::resizeEvent(QResi
 	_close.setGeometry(width() - padding - _close.width(), height() - padding - _close.height(), _close.width(), _close.height());
 }
 
+#ifndef TDESKTOP_DISABLE_CRASH_REPORTS
 LastCrashedWindow::UpdaterData::UpdaterData(QWidget *buttonParent)
 : check(buttonParent)
 , skip(buttonParent, false) {
@@ -1197,3 +1198,4 @@ void NetworkSettingsWindow::updateContro
 		setGeometry(_parent->x() + (_parent->width() - w) / 2, _parent->y() + (_parent->height() - h) / 2, w, h);
 	}
 }
+#endif  // !TDESKTOP_DISABLE_CRASH_REPORTS
--- a/Telegram/SourceFiles/core/crash_report_window.h
+++ b/Telegram/SourceFiles/core/crash_report_window.h
@@ -87,6 +87,7 @@ private:
 
 };
 
+#ifndef TDESKTOP_DISABLE_CRASH_REPORTS
 class LastCrashedWindow : public PreLaunchWindow {
 
 public:
@@ -209,3 +210,4 @@ private:
 	rpl::event_stream<MTP::ProxyData> _saveRequests;
 
 };
+#endif  // !TDESKTOP_DISABLE_CRASH_REPORTS
--- a/Telegram/SourceFiles/core/sandbox.cpp
+++ b/Telegram/SourceFiles/core/sandbox.cpp
@@ -380,6 +380,8 @@ void Sandbox::singleInstanceChecked() {
 		new NotStartedWindow();
 		return;
 	}
+
+#ifndef TDESKTOP_DISABLE_CRASH_REPORTS
 	const auto result = CrashReports::Start();
 	v::match(result, [&](CrashReports::Status status) {
 		if (status == CrashReports::CantOpen) {
@@ -408,6 +410,9 @@ void Sandbox::singleInstanceChecked() {
 			refreshGlobalProxy();
 		}, window->lifetime());
 	});
+#else  // !TDESKTOP_DISABLE_CRASH_REPORTS
+	launchApplication();
+#endif  // !TDESKTOP_DISABLE_CRASH_REPORTS
 }
 
 void Sandbox::socketDisconnected() {
