]> sigrok.org Git - pulseview.git/blobdiff - pv/view/cursor.cpp
View: Store CursorPair in a shared_ptr
[pulseview.git] / pv / view / cursor.cpp
index f4a5df6f10f4b2e5321b97be12d3d1d825e0a116..836d0e93d758fd911e371ef5383eda291ffa41c6 100644 (file)
@@ -81,9 +81,10 @@ QRectF Cursor::get_label_rect(const QRect &rect) const
 
 shared_ptr<Cursor> Cursor::get_other_cursor() const
 {
 
 shared_ptr<Cursor> Cursor::get_other_cursor() const
 {
-       const CursorPair &cursors = view_.cursors();
-       return (cursors.first().get() == this) ?
-               cursors.second() : cursors.first();
+       const shared_ptr<CursorPair> cursors(view_.cursors());
+       assert(cursors);
+       return (cursors->first().get() == this) ?
+               cursors->second() : cursors->first();
 }
 
 } // namespace view
 }
 
 } // namespace view