icon-theme: Only add theme load profiler mark if we actually load theme
authorAlexander Larsson <alexl@redhat.com>
Tue, 28 Jan 2020 16:08:52 +0000 (17:08 +0100)
committerAlexander Larsson <alexl@redhat.com>
Thu, 30 Jan 2020 09:53:43 +0000 (10:53 +0100)
gtk/gtkicontheme.c

index 3b15af972d499f785cc891dcccda9cd6b3e8a7f8..3822b9b69bbc5f711f6ea42e9e8b67d8e2ded89f 100644 (file)
@@ -1735,7 +1735,6 @@ ensure_valid_themes (GtkIconTheme *self,
 {
   GTimeVal tv;
   gboolean was_valid = self->themes_valid;
-  gint64 before = g_get_monotonic_time ();
 
   if (self->themes_valid)
     {
@@ -1756,18 +1755,21 @@ ensure_valid_themes (GtkIconTheme *self,
 
   if (!self->themes_valid)
     {
+      gint64 before;
       if (non_blocking)
         return FALSE;
 
+       before = g_get_monotonic_time ();
+
       load_themes (self);
 
+      if (gdk_profiler_is_running ())
+        gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "icon theme load", NULL);
+
       if (was_valid)
         queue_theme_changed (self);
     }
 
-  if (gdk_profiler_is_running ())
-    gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "icon theme load", NULL);
-
   return TRUE;
 }