]> sigrok.org Git - pulseview.git/blobdiff - pv/view/view.cpp
Trace/AnalogSignal: Improve contrast and precision of the trace lines
[pulseview.git] / pv / view / view.cpp
index 5649bdc849e5609dea698a21bce41b8d60102e2e..8d5bd6d3ad02b836d7d5ee1f0f29e8f1cccf4a99 100644 (file)
@@ -1038,13 +1038,15 @@ void View::signals_changed()
                                        offset += extents.second;
                        }
 
-                       // Assign proper vertical offsets to each channel in the group
-                       new_trace_group->restack_items();
-
-                       // If this is a new group, enqueue it in the new top level
-                       // items list
-                       if (!new_traces_in_group.empty() && new_trace_group)
-                               new_top_level_items.push_back(new_trace_group);
+                       if (new_trace_group) {
+                               // Assign proper vertical offsets to each channel in the group
+                               new_trace_group->restack_items();
+
+                               // If this is a new group, enqueue it in the new top level
+                               // items list
+                               if (!new_traces_in_group.empty())
+                                       new_top_level_items.push_back(new_trace_group);
+                       }
                }
 
        // Enqueue the remaining logic channels in a group
@@ -1085,8 +1087,10 @@ void View::signals_changed()
 
        // Remove any empty trace groups
        for (shared_ptr<TraceGroup> group : list_by_type<TraceGroup>())
-               if (group->child_items().size() == 0)
+               if (group->child_items().size() == 0) {
                        remove_child_item(group);
+                       group.reset();
+               }
 
        // Add and position the pending top levels items
        for (auto item : new_top_level_items) {