]> sigrok.org Git - pulseview.git/commitdiff
Header: Use list_by_type in on_ungroup
authorJoel Holdsworth <redacted>
Sun, 16 Aug 2015 15:22:08 +0000 (09:22 -0600)
committerJoel Holdsworth <redacted>
Sun, 18 Oct 2015 21:32:28 +0000 (15:32 -0600)
pv/view/header.cpp

index 60d64b2f401f2483aad1226dc00e66d62ca54191..be4cebcb26f40b4e23ffe337ebe211a1c745da97 100644 (file)
@@ -198,15 +198,14 @@ void Header::on_ungroup()
        bool restart;
        do {
                restart = false;
-               for (const shared_ptr<TraceTreeItem> r : view_) {
-                       const shared_ptr<TraceGroup> tg =
-                               dynamic_pointer_cast<TraceGroup>(r);
-                       if (tg && tg->selected()) {
+               const vector< shared_ptr<TraceGroup> > groups(
+                       view_.list_by_type<TraceGroup>());
+               for (const shared_ptr<TraceGroup> tg : groups)
+                       if (tg->selected()) {
                                tg->ungroup();
                                restart = true;
                                break;
                        }
-               }
        } while (restart);
 }