Skip to content

Commit

Permalink
Fix build on macOS and Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed May 3, 2021
1 parent db6b571 commit 691dcb8
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions Telegram/SourceFiles/core/crash_reports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ For license and copyright information please follow this link:
#include <mutex>

#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS

// see https://blog.inventic.eu/2012/08/qt-and-google-breakpad/
#ifdef Q_OS_WIN

#pragma warning(push)
#pragma warning(disable:4091)
#include "client/windows/handler/exception_handler.h"
#pragma warning(pop)

#elif defined Q_OS_MAC // Q_OS_WIN
#elif defined Q_OS_UNIX // Q_OS_WIN

#include <execinfo.h>
#include <signal.h>
#include <sys/syscall.h>

#ifdef Q_OS_MAC

#include <dlfcn.h>
#include <unistd.h>

Expand All @@ -39,16 +39,13 @@ For license and copyright information please follow this link:
#include "client/crashpad_client.h"
#endif // else for MAC_USE_BREAKPAD

#elif defined Q_OS_UNIX // Q_OS_MAC

#include <execinfo.h>
#include <signal.h>
#include <sys/syscall.h>
#else // Q_OS_MAC

#include "client/linux/handler/exception_handler.h"

#endif // Q_OS_UNIX
#endif // Q_OS_MAC

#endif // Q_OS_WIN
#endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS

namespace CrashReports {
Expand Down Expand Up @@ -203,7 +200,7 @@ struct sigaction OldSigActions[32]/* = { 0 }*/;

void RestoreSignalHandlers() {
for (const auto signum : HandledSignals) {
sigaction(signum, &OldSigActions[signal], nullptr);
sigaction(signum, &OldSigActions[signum], nullptr);
}
}

Expand Down Expand Up @@ -446,7 +443,7 @@ Status Restart() {
sigact.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;

for (const auto signum : HandledSignals) {
sigaction(signum, &sigact, &OldSigActions[signal]);
sigaction(signum, &sigact, &OldSigActions[signum]);
}
#else // !Q_OS_WIN
for (const auto signum : HandledSignals) {
Expand Down

0 comments on commit 691dcb8

Please sign in to comment.