Added "shutdown" crash annotation and crash menu option

This commit is contained in:
Anthony J. Thibault 2019-08-24 11:12:28 -07:00
parent 860b5d0970
commit d410cb4fda
4 changed files with 24 additions and 0 deletions

View file

@ -167,6 +167,7 @@
#include "avatar/MyCharacterController.h"
#include "CrashRecoveryHandler.h"
#include "CrashHandler.h"
#include <CrashHelpers.h>
#include "devices/DdeFaceTracker.h"
#include "DiscoverabilityManager.h"
#include "GLCanvas.h"
@ -2675,6 +2676,8 @@ void Application::updateHeartbeat() const {
}
void Application::onAboutToQuit() {
setCrashAnnotation("shutdown", "1");
// quickly save AvatarEntityData before the EntityTree is dismantled
getMyAvatar()->saveAvatarEntityDataToSettings();
@ -2713,6 +2716,11 @@ void Application::onAboutToQuit() {
cleanupBeforeQuit();
if (_crashOnShutdown) {
// triggered by crash menu
crash::nullDeref();
}
getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::SHUTDOWN);
}
@ -9522,6 +9530,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";