summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorTor Arne Vestbø <torarnv@gmail.com>2020-01-31 13:27:17 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-02-01 00:49:07 +0100
commitac0a266e75cd117ecf34d25cc5c947ec5e9d2c01 (patch)
tree2500292f22255a769eb62de081ecfe3a88112802 /src/testlib
parente6f479a8307ad119865870664eb6da70f5a520d6 (diff)
testlib: Don't disable watchdog when the macOS crash reporter is enabled
The debuggerPresent() function was used both to decide whether we should print our own stacktrace, and if we should start the watchdog timer, but checking for the macOS crash reporter only applies to the former usecase. The crash reporter check has now been split into a separate function, only used to decide whether we should print our own stacktrace or not. Change-Id: I282aa57a51c14b07d3cbd547b551b6bf81b61897 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 7b407c9073..d28cfd8613 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -154,10 +154,6 @@ static bool debuggerPresent()
#elif defined(Q_OS_WIN)
return IsDebuggerPresent();
#elif defined(Q_OS_MACOS)
- auto equals = [](CFStringRef str1, CFStringRef str2) -> bool {
- return CFStringCompare(str1, str2, kCFCompareCaseInsensitive) == kCFCompareEqualTo;
- };
-
// Check if there is an exception handler for the process:
mach_msg_type_number_t portCount = 0;
exception_mask_t masks[EXC_TYPES_COUNT];
@@ -174,21 +170,31 @@ static bool debuggerPresent()
}
}
}
+ return false;
+#else
+ // TODO
+ return false;
+#endif
+}
- // Ok, no debugger attached. So, let's see if CrashReporter will throw up a dialog. If so, we
- // leave it to the OS to do the stack trace.
+static bool hasSystemCrashReporter()
+{
+#if defined(Q_OS_MACOS)
CFStringRef crashReporterType = static_cast<CFStringRef>(
CFPreferencesCopyAppValue(CFSTR("DialogType"), CFSTR("com.apple.CrashReporter")));
if (crashReporterType == nullptr)
return true;
+ auto equals = [](CFStringRef str1, CFStringRef str2) -> bool {
+ return CFStringCompare(str1, str2, kCFCompareCaseInsensitive) == kCFCompareEqualTo;
+ };
+
const bool createsStackTrace =
!equals(crashReporterType, CFSTR("server")) &&
!equals(crashReporterType, CFSTR("none"));
CFRelease(crashReporterType);
return createsStackTrace;
#else
- // TODO
return false;
#endif
}
@@ -216,7 +222,7 @@ static void stackTrace()
if (ok && disableStackDump == 1)
return;
- if (debuggerPresent())
+ if (debuggerPresent() || hasSystemCrashReporter())
return;
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)