From c57258c40cb1435be69ef83abfae43b135d46f96 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 17 May 2019 17:00:44 -0700 Subject: [PATCH] libsysprof-ui: tweak sorting of marks --- src/libsysprof-ui/sysprof-marks-model.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libsysprof-ui/sysprof-marks-model.c b/src/libsysprof-ui/sysprof-marks-model.c index 219bf420..a9e1e3b0 100644 --- a/src/libsysprof-ui/sysprof-marks-model.c +++ b/src/libsysprof-ui/sysprof-marks-model.c @@ -298,10 +298,16 @@ item_compare (gconstpointer a, return -1; else if (ia->begin_time > ib->begin_time) return 1; - else if (ia->end_time > ib->end_time) + + /* Sort items with longer duration first, as they might be + * "overarching" marks containing other marks. + */ + if (ia->end_time > ib->end_time) + return -1; + else if (ib->end_time > ia->end_time) return 1; - else - return 0; + + return 0; } static void