kernel-shark: Implement proper reser for the OpenGL widget
PATCH 1/1 kernel-shark: Implement proper reser for the OpenGL widget
When loading a new trace.dat file the OpenGL widget has to be properly reset. One important operation of this reset is to set the "_data" pointer to NULL. This will block all attempts for drawing something before the widget is set again. The bug was introduced in
7d057ae56 ("kernel-shark-qt: Add Trace Graph widget")
but had no effect until
94efea960 ("kernel-shark-qt: Handle the case when the range of ...")
because the number of bins of the model was zero, so nothing was plotted anyway.
Reported-by Steven Rostedt (VMware) <[email protected]>
Fixes 7d057ae56 ("kernel-shark-qt: Add Trace Graph widget")
Signed-off-by Yordan Karadzhov <[email protected]>
--- kernel-shark/src/KsGLWidget.cpp | 9 +++++++++ kernel-shark/src/KsGLWidget.hpp | 2 ++ kernel-shark/src/KsTraceGraph.cpp | 6 ++---- 3 files changed, 13 insertions(+), 4 deletions(-)
kernel-shark/src/KsGLWidget.cpp +9 -0
@@ -109,6 +109,15 @@ void KsGLWidget::paintGL() _mState->activeMarker().draw(); } +/** Reset (empty) the widget. */ +void KsGLWidget::reset() +{ + _cpuList = {}; + _taskList = {}; + _data = nullptr; + _model.reset(); +} + /** Reimplemented event handler used to receive mouse press events. */ void KsGLWidget::mousePressEvent(QMouseEvent *event) {
kernel-shark/src/KsGLWidget.hpp +2 -0
@@ -37,6 +37,8 @@ public: void paintGL() override; + void reset(); + void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
kernel-shark/src/KsTraceGraph.cpp +2 -4
@@ -201,15 +201,13 @@ void KsTraceGraph::setMarkerSM(KsDualMarkerSM *m) /** Reset (empty) the widget. */ void KsTraceGraph::reset() { - /* Clear the all graph lists and update. */ - _glWindow._cpuList = {}; - _glWindow._taskList = {}; + /* Reset (empty) the OpenGL widget. */ + _glWindow.reset(); _labelP2.setText(""); for (auto l1: {&_labelI1, &_labelI2, &_labelI3, &_labelI4, &_labelI5}) l1->setText(""); - _glWindow.model()->reset(); _selfUpdate(); for (auto l2: {&_labelXMin, &_labelXMid, &_labelXMax}) l2->setText("");
Signature · 1 line
2.17.1