MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / markStartup

Method markStartup

app/src/Misc/CrashTracker.cpp:95–114  ·  view source on GitHub ↗

* @brief Reads the prior-run flag, updates the streak counter, and arms the new run. */

Source from the content-addressed store, hash-verified

93 * @brief Reads the prior-run flag, updates the streak counter, and arms the new run.
94 */
95void Misc::CrashTracker::markStartup()
96{
97 const bool wasRunning = m_settings.value(kKeyRunning, false).toBool();
98 if (wasRunning) {
99 m_previousRunCrashed = true;
100 m_consecutiveCrashes = m_settings.value(kKeyConsecutive, 0).toInt() + 1;
101 m_lastCheckpoint = m_settings.value(kKeyCheckpoint, QString()).toString();
102 m_lastCrashAt = QDateTime::currentDateTimeUtc().toString(Qt::ISODate);
103 m_settings.setValue(kKeyConsecutive, m_consecutiveCrashes);
104 m_settings.setValue(kKeyLastCrash, m_lastCrashAt);
105 } else {
106 m_previousRunCrashed = false;
107 m_consecutiveCrashes = 0;
108 m_settings.setValue(kKeyConsecutive, 0);
109 }
110
111 m_settings.setValue(kKeyRunning, true);
112 m_settings.setValue(kKeyCheckpoint, QStringLiteral("startup"));
113 m_settings.sync();
114}
115
116/**
117 * @brief Clears the running flag and resets the consecutive-crash counter.

Callers 1

mainFunction · 0.80

Calls 1

valueMethod · 0.45

Tested by

no test coverage detected