diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e0ac3df30d..9ba886fcd2 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -74,6 +74,7 @@ #include #include #include +#include #include #include #include @@ -2679,6 +2680,8 @@ void Application::updateHeartbeat() const { } void Application::onAboutToQuit() { + setCrashAnnotation("shutdown", "1"); + // quickly save AvatarEntityData before the EntityTree is dismantled getMyAvatar()->saveAvatarEntityDataToSettings(); @@ -2717,6 +2720,11 @@ void Application::onAboutToQuit() { cleanupBeforeQuit(); + if (_crashOnShutdown) { + // triggered by crash menu + crash::nullDeref(); + } + getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::SHUTDOWN); } @@ -9527,6 +9535,14 @@ void Application::showUrlHandler(const QUrl& url) { } }); } + +// used to test "shutdown" crash annotation. +void Application::crashOnShutdown() { + qDebug() << "crashOnShutdown(), ON PURPOSE!"; + _crashOnShutdown = true; + quit(); +} + void Application::overrideEntry(){ _overrideEntry = true; } diff --git a/interface/src/Application.h b/interface/src/Application.h index 913671473d..20abbf2baf 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -497,6 +497,9 @@ public slots: bool gpuTextureMemSizeStable(); void showUrlHandler(const QUrl& url); + // used to test "shutdown" crash annotation. + void crashOnShutdown(); + private slots: void onDesktopRootItemCreated(QQuickItem* qmlContext); void onDesktopRootContextCreated(QQmlContext* qmlContext); @@ -844,5 +847,7 @@ private: bool _overrideEntry { false }; VisionSqueeze _visionSqueeze; + + bool _crashOnShutdown { false }; }; #endif // hifi_Application_h diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 4cf78c23ee..8c6292681b 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -763,6 +763,8 @@ Menu::Menu() { action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNewFaultThreaded); connect(action, &QAction::triggered, qApp, []() { std::thread(crash::newFault).join(); }); + addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashOnShutdown, 0, qApp, SLOT(crashOnShutdown())); + // Developer > Show Statistics addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::Stats, 0, true); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 70687786a9..7dff264adc 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -72,6 +72,7 @@ namespace MenuOption { const QString CrashNullDereferenceThreaded = "Null Dereference (threaded)"; const QString CrashAbort = "Abort"; const QString CrashAbortThreaded = "Abort (threaded)"; + const QString CrashOnShutdown = "Crash During Shutdown"; const QString CrashOutOfBoundsVectorAccess = "Out of Bounds Vector Access"; const QString CrashOutOfBoundsVectorAccessThreaded = "Out of Bounds Vector Access (threaded)"; const QString CrashNewFault = "New Fault";