Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-perf-monitor-dangling-timer-pointer-fix into lp:ubuntu-ui-toolkit/staging

Proposed by Loïc Molinari
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1859
Merged at revision: 1859
Proposed branch: lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-perf-monitor-dangling-timer-pointer-fix
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 47 lines (+8/-8)
2 files modified
src/Ubuntu/Components/plugin/ucperformancemonitor.cpp (+7/-7)
src/Ubuntu/Components/plugin/ucperformancemonitor.h (+1/-1)
To merge this branch: bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-perf-monitor-dangling-timer-pointer-fix
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Zoltan Balogh Approve
Review via email: mp+286493@code.launchpad.net

Commit message

Fixed performance monitor crash because of a NULL timer pointer dereference.

Description of the change

Fixed performance monitor crash because of a NULL timer pointer dereference.

To post a comment you must log in.
Revision history for this message
Zoltan Balogh (bzoltan) :
review: Approve
Revision history for this message
Zsombor Egri (zsombi) wrote :

You should not approve it without us reviewing :)

1859. By Loïc Molinari

Prevented corrupted values.

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/plugin/ucperformancemonitor.cpp'
--- src/Ubuntu/Components/plugin/ucperformancemonitor.cpp 2016-01-29 07:43:58 +0000
+++ src/Ubuntu/Components/plugin/ucperformancemonitor.cpp 2016-02-18 12:20:49 +0000
@@ -30,7 +30,6 @@
30 QObject(parent),30 QObject(parent),
31 m_framesAboveThreshold(0),31 m_framesAboveThreshold(0),
32 m_warningCount(0),32 m_warningCount(0),
33 m_timer(NULL),
34 m_window(NULL)33 m_window(NULL)
35{34{
36 QObject::connect((QGuiApplication*)QGuiApplication::instance(), &QGuiApplication::applicationStateChanged,35 QObject::connect((QGuiApplication*)QGuiApplication::instance(), &QGuiApplication::applicationStateChanged,
@@ -92,16 +91,17 @@
9291
93void UCPerformanceMonitor::startTimer()92void UCPerformanceMonitor::startTimer()
94{93{
95 if (!m_timer) {94 m_timer.start();
96 m_timer.reset(new QElapsedTimer);
97 }
98 m_timer->start();
99}95}
10096
101void UCPerformanceMonitor::stopTimer()97void UCPerformanceMonitor::stopTimer()
102{98{
103 int totalTimeInMs = m_timer->elapsed();99 if (!m_timer.isValid()) {
104 m_timer->invalidate();100 return;
101 }
102
103 const int totalTimeInMs = m_timer.elapsed();
104 m_timer.invalidate();
105105
106 if (totalTimeInMs >= singleFrameThreshold) {106 if (totalTimeInMs >= singleFrameThreshold) {
107 qCWarning(ucPerformance, "Last frame took %d ms to render.", totalTimeInMs);107 qCWarning(ucPerformance, "Last frame took %d ms to render.", totalTimeInMs);
108108
=== modified file 'src/Ubuntu/Components/plugin/ucperformancemonitor.h'
--- src/Ubuntu/Components/plugin/ucperformancemonitor.h 2016-01-19 13:01:44 +0000
+++ src/Ubuntu/Components/plugin/ucperformancemonitor.h 2016-02-18 12:20:49 +0000
@@ -45,7 +45,7 @@
45private:45private:
46 int m_framesAboveThreshold;46 int m_framesAboveThreshold;
47 int m_warningCount;47 int m_warningCount;
48 QSharedPointer<QElapsedTimer> m_timer;48 QElapsedTimer m_timer;
49 QQuickWindow* m_window;49 QQuickWindow* m_window;
50};50};
5151

Subscribers

People subscribed via source and target branches