Merge pull request #16098 from hyperlogic/feature/backtrace-shutdown-flag

Added "shutdown" crash annotation and crash menu option
This commit is contained in:
Shannon Romano 2019-08-27 10:57:07 -07:00 committed by GitHub
commit 3134332513
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 0 deletions

View file

@ -74,6 +74,7 @@
#include <Midi.h>
#include <AudioInjectorManager.h>
#include <AvatarBookmarks.h>
#include <CrashHelpers.h>
#include <CursorManager.h>
#include <VirtualPadManager.h>
#include <DebugDraw.h>
@ -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;
}

View file

@ -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

View file

@ -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);

View file

@ -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";