In https://gitlab.gnome.org/GNOME/gtk/issues/1169 Daniel Boles pointed
out that the scaffolding is already there, it's just wrong. 

Assuming that removable always implies name != 0, we can fix this
printf("%s", NULL) as follows:

Index: Makefile
===================================================================
RCS file: /var/cvs/ports/x11/gtk+2/Makefile,v
retrieving revision 1.222
diff -u -p -r1.222 Makefile
--- Makefile    9 Jan 2018 13:22:24 -0000       1.222
+++ Makefile    22 Jun 2018 12:26:00 -0000
@@ -9,6 +9,7 @@ COMMENT-cups=           gtk+2 CUPS print backend
 
 GNOME_VERSION=         2.24.32
 GNOME_PROJECT=         gtk+
+REVISION=              0
 
 PKGNAME-main=          gtk+2-${GNOME_VERSION}
 PKGNAME-cups=          gtk+2-cups-${GNOME_VERSION}
Index: patches/patch-gtk_gtkfilechooserdefault_c
===================================================================
RCS file: patches/patch-gtk_gtkfilechooserdefault_c
diff -N patches/patch-gtk_gtkfilechooserdefault_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-gtk_gtkfilechooserdefault_c   22 Jun 2018 12:41:43 -0000
@@ -0,0 +1,35 @@
+$OpenBSD$
+
+Index: gtk/gtkfilechooserdefault.c
+--- gtk/gtkfilechooserdefault.c.orig
++++ gtk/gtkfilechooserdefault.c
+@@ -2811,7 +2811,7 @@ bookmarks_check_remove_sensitivity (GtkFileChooserDefa
+   GtkTreeIter iter;
+   gboolean removable = FALSE;
+   gchar *name = NULL;
+-  gchar *tip;
++  gchar *tip = NULL;
+   
+   if (shortcuts_get_selected (impl, &iter))
+     {
+@@ -2823,16 +2823,16 @@ bookmarks_check_remove_sensitivity (GtkFileChooserDefa
+ 
+       if (removable)
+         tip = g_strdup_printf (_("Remove the bookmark '%s'"), name);
+-      else
++      else if (name != NULL)
+         tip = g_strdup_printf (_("Bookmark '%s' cannot be removed"), name);
+-
+-      gtk_widget_set_tooltip_text (impl->browse_shortcuts_remove_button, tip);
+-      g_free (tip);
+     }
++  if (tip != NULL)
++    gtk_widget_set_tooltip_text (impl->browse_shortcuts_remove_button, tip);
+   else
+     gtk_widget_set_tooltip_text (impl->browse_shortcuts_remove_button,
+                                  _("Remove the selected bookmark"));
+   g_free (name);
++  g_free (tip);
+ }
+ 
+ static void

Reply via email to