[gtk+] iconhelper: Short-circuit clear() if it's cleared already
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] iconhelper: Short-circuit clear() if it's cleared already
- Date: Sat, 14 Oct 2017 17:19:22 +0000 (UTC)
commit ce5560a790fe4c20a1c8abe52fd223491129d01a
Author: Timm Bäder <mail baedert org>
Date: Sat Oct 14 14:58:13 2017 +0200
iconhelper: Short-circuit clear() if it's cleared already
gtk/gtkiconhelper.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 51954a7..5fe7689 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -85,12 +85,13 @@ _gtk_icon_helper_clear (GtkIconHelper *self)
g_clear_object (&self->texture);
g_clear_pointer (&self->rendered_surface, cairo_surface_destroy);
- gtk_image_definition_unref (self->def);
- self->def = gtk_image_definition_new_empty ();
-
+ if (gtk_image_definition_get_storage_type (self->def) != GTK_IMAGE_EMPTY)
+ {
+ gtk_image_definition_unref (self->def);
+ self->def = gtk_image_definition_new_empty ();
+ gtk_icon_helper_invalidate (self);
+ }
self->icon_size = GTK_ICON_SIZE_INVALID;
-
- gtk_icon_helper_invalidate (self);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]