[gimp/gimp-2-8] build/odx: add patch for Bug 743717 to the build



commit 5bb60a272a085286f0610a1a212e95dde815fb85
Author: Kristian Rietveld <kris loopnest org>
Date:   Sun Feb 5 15:17:32 2017 +0100

    build/odx: add patch for Bug 743717 to the build
    
    Bug 743717 concerns crashes during clipboard operations with a clipboard
    manager active.

 build/osx/README                                   |    1 +
 build/osx/gimp.modules                             |    2 +
 ...-clipboard-crashes-with-clipboard-manager.patch |   86 ++++++++++++++++++++
 3 files changed, 89 insertions(+), 0 deletions(-)
---
diff --git a/build/osx/README b/build/osx/README
index 44382b2..96764aa 100644
--- a/build/osx/README
+++ b/build/osx/README
@@ -77,6 +77,7 @@ don't need it.
 3. Get the patches for the GIMP build:
 curl --create-dirs -o 
$HOME/gimp/directory/patches/gmi2-improve-internationalization-of-App-menu-and-other-s.patch 
https://git.gnome.org/browse/gimp/plain/build/osx/patches/gmi2-improve-internationalization-of-App-menu-and-other-s.patch?h=gimp-2-8
 curl -o $HOME/gimp/directory/patches/gmi2-keep-separators-between-placeholders.patch 
https://git.gnome.org/browse/gimp/plain/build/osx/patches/gmi2-keep-separators-between-placeholders.patch?h=gimp-2-8
+curl -o $HOME/gimp/directory/patches/gtk2-quartz-fix-clipboard-crashes-with-clipboard-manager.patch 
https://git.gnome.org/browse/gimp/plain/build/osx/patches/gtk2-quartz-fix-clipboard-crashes-with-clipboard-manager.patch?h=gimp-2-8
 curl -o $HOME/gimp/directory/patches/gtk2-quartz-fix-dnd-timing-issue.patch 
https://git.gnome.org/browse/gimp/plain/build/osx/patches/gtk2-quartz-fix-dnd-timing-issue.patch?h=gimp-2-8
 curl -o $HOME/gimp/directory/patches/gtk2-quartz-fix-regression-in-imquartz.patch 
https://git.gnome.org/browse/gimp/plain/build/osx/patches/gtk2-quartz-fix-regression-in-imquartz.patch?h=gimp-2-8
 curl -o $HOME/gimp/directory/patches/gtk2-quartz-handle-didMove-and-didResize-in-the-same-way.patch 
https://git.gnome.org/browse/gimp/plain/build/osx/patches/gtk2-quartz-handle-didMove-and-didResize-in-the-same-way.patch?h=gimp-2-8
diff --git a/build/osx/gimp.modules b/build/osx/gimp.modules
index faafee7..9191e30 100644
--- a/build/osx/gimp.modules
+++ b/build/osx/gimp.modules
@@ -266,6 +266,8 @@
                        <patch file="gtk2-quartz-fix-regression-in-imquartz.patch" strip="1" />
                        <!-- Until https://bugzilla.gnome.org/show_bug.cgi?id=767091 is merged -->
                        <patch file="gtk2-quartz-fix-dnd-timing-issue.patch" strip="1" />
+                       <!-- Until https://bugzilla.gnome.org/show_bug.cgi?id=743717 is merged -->
+                       <patch file="gtk2-quartz-fix-clipboard-crashes-with-clipboard-manager.patch" 
strip="1" />
                </branch>
                <dependencies>
                        <dep package="glib" />
diff --git a/build/osx/patches/gtk2-quartz-fix-clipboard-crashes-with-clipboard-manager.patch 
b/build/osx/patches/gtk2-quartz-fix-clipboard-crashes-with-clipboard-manager.patch
new file mode 100644
index 0000000..91ed119
--- /dev/null
+++ b/build/osx/patches/gtk2-quartz-fix-clipboard-crashes-with-clipboard-manager.patch
@@ -0,0 +1,86 @@
+From dd740bfebd40e0ec4953d939484ed23a7e095ae4 Mon Sep 17 00:00:00 2001
+From: Kristian Rietveld <kris loopnest org>
+Date: Sun, 1 Jan 2017 21:04:04 +0100
+Subject: [PATCH] Bug 743717 - Crashes on clipboard operation, influence by
+ clipboard ...
+
+The problem here was that NSPasteboard would release the clipboard
+owner if all data items were transferred. When trying to re-use this
+owner at a later point, GTK+ would attempt a retain call on a released
+object and crash.
+
+Fix this by not immediately releasing the owner after declaring types,
+so by keeping our own reference around.
+---
+ gtk/gtkclipboard-quartz.c | 30 ++++++++++++++++++++----------
+ 1 file changed, 20 insertions(+), 10 deletions(-)
+
+diff --git a/gtk/gtkclipboard-quartz.c b/gtk/gtkclipboard-quartz.c
+index 5a61838..0c0347c 100644
+--- a/gtk/gtkclipboard-quartz.c
++++ b/gtk/gtkclipboard-quartz.c
+@@ -333,7 +333,6 @@ gtk_clipboard_set_contents (GtkClipboard         *clipboard,
+                           gpointer              user_data,
+                           gboolean              have_owner)
+ {
+-  GtkClipboardOwner *owner;
+   NSSet *types;
+   NSAutoreleasePool *pool;
+ 
+@@ -369,26 +368,35 @@ gtk_clipboard_set_contents (GtkClipboard         *clipboard,
+    */
+   if (user_data && user_data == clipboard->user_data)
+     {
+-      owner = [clipboard->owner retain];
+-
+-      owner->setting_same_owner = TRUE;
++      clipboard->owner->setting_same_owner = TRUE;
+       clipboard->change_count = [clipboard->pasteboard declareTypes: [types allObjects]
+-                                                              owner: owner];
+-      owner->setting_same_owner = FALSE;
++                                                              owner: clipboard->owner];
++      clipboard->owner->setting_same_owner = FALSE;
+     }
+   else
+     {
+-      owner = [[GtkClipboardOwner alloc] initWithClipboard:clipboard];
++      GtkClipboardOwner *new_owner;
+ 
++      /* We do not set the new owner on clipboard->owner immediately,
++       * because declareTypes could (but not always does -- see also the
++       * comment at pasteboardChangedOwner above) cause clipboard_unset
++       * to be called, which releases clipboard->owner.
++       */
++      new_owner = [[GtkClipboardOwner alloc] initWithClipboard:clipboard];
+       clipboard->change_count = [clipboard->pasteboard declareTypes: [types allObjects]
+-                                                              owner: owner];
++                                                              owner: new_owner];
++
++      /* In case pasteboardChangedOwner was not triggered, check to see
++       * whether the previous owner still needs to be released.
++       */
++      if (clipboard->owner)
++        [clipboard->owner release];
++      clipboard->owner = new_owner;
+     }
+ 
+-  [owner release];
+   [types release];
+   [pool release];
+ 
+-  clipboard->owner = owner;
+   clipboard->user_data = user_data;
+   clipboard->have_owner = have_owner;
+   if (have_owner)
+@@ -478,6 +486,8 @@ clipboard_unset (GtkClipboard *clipboard)
+   g_free (clipboard->storable_targets);
+   clipboard->storable_targets = NULL;
+ 
++  if (clipboard->owner)
++    [clipboard->owner release];
+   clipboard->owner = NULL;
+   clipboard->get_func = NULL;
+   clipboard->clear_func = NULL;
+-- 
+1.9.5 (Apple Git-50.3)
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]