[Pkg-cli-libs-commits] [gtk-sharp2] 01/01: fix Gtk.TreeView.get/set_Model() throwing NullReferenceException

Mirco Bauer meebey at moszumanska.debian.org
Mon Apr 17 06:55:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

meebey pushed a commit to branch master
in repository gtk-sharp2.

commit bf035d9226cdf18ed9481d71de3a6a26f08ed863
Author: Mirco Bauer <meebey at debian.org>
Date:   Mon Apr 17 13:03:02 2017 +0800

    fix Gtk.TreeView.get/set_Model() throwing NullReferenceException
    
    This fix is a cherry-picked commit 4ac71507fffce997207215ac3f8b38471ce60a14 from
    upstream's git repository.
    
    The fix is already included in a newer upstream version (GTK# 2.12.41), but for
    getting a freeze exception I have only backported the fix that affects the
    Debian release. (Closes: #860450)
---
 debian/patches/04_fix_treeview_model_ref | 63 ++++++++++++++++++++++++++++++++
 debian/patches/series                    |  1 +
 2 files changed, 64 insertions(+)

diff --git a/debian/patches/04_fix_treeview_model_ref b/debian/patches/04_fix_treeview_model_ref
new file mode 100644
index 0000000..7cc0089
--- /dev/null
+++ b/debian/patches/04_fix_treeview_model_ref
@@ -0,0 +1,63 @@
+Index: gtk-sharp2/gtk/Gtk.metadata
+===================================================================
+--- gtk-sharp2.orig/gtk/Gtk.metadata	2017-04-17 12:03:38.972461869 +0800
++++ gtk-sharp2/gtk/Gtk.metadata	2017-04-17 12:03:38.968461869 +0800
+@@ -950,8 +950,5 @@
+   <attr path="/api/namespace/boxed[@cname='GtkRecentInfo']/method[@cname='gtk_recent_info_get_icon']/return-type" name="owned">true</attr>
+   <attr path="/api/namespace/boxed[@cname='GtkSelectionData']/method[@cname='gtk_selection_data_get_pixbuf']/return-type" name="owned">true</attr>
+   <attr path="/api/namespace/object[@cname='GtkStyle']/method[@cname='gtk_style_render_icon']/return-type" name="owned">true</attr>
+-  <attr path="/api/namespace/object[@cname='GtkTreeView']/property[@cname='model']" name="readable">false</attr>
+-  <attr path="/api/namespace/object[@cname='GtkTreeView']/property[@cname='model']" name="writeable">false</attr>
+-  <attr path="/api/namespace/object[@cname='GtkTreeView']/method[@cname='gtk_tree_view_get_model']" name="hidden">1</attr>
+-  <attr path="/api/namespace/object[@cname='GtkTreeView']/method[@cname='gtk_tree_view_set_model']" name="hidden">1</attr>
++  <attr path="/api/namespace/object[@cname='GtkTreeView']/constructor[@cname='gtk_tree_view_new_with_model']" name="hidden">1</attr>
+ </metadata>
+Index: gtk-sharp2/gtk/TreeView.custom
+===================================================================
+--- gtk-sharp2.orig/gtk/TreeView.custom	2017-04-17 12:03:38.972461869 +0800
++++ gtk-sharp2/gtk/TreeView.custom	2017-04-17 12:03:38.968461869 +0800
+@@ -25,27 +25,27 @@
+ 
+ 
+ 		[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+-		static extern IntPtr gtk_tree_view_get_model(IntPtr raw);
+-
+-		[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+-		static extern void gtk_tree_view_set_model(IntPtr raw, IntPtr model);
++		static extern IntPtr gtk_tree_view_new_with_model(IntPtr model);
+ 
+ 		[DllImport("libgobject-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
+-		static extern void g_object_unref (IntPtr raw);
++		static extern void g_object_ref (IntPtr raw);
+ 
+-		[GLib.Property ("model")]
+-		public Gtk.TreeModel Model {
+-			get  {
+-				IntPtr raw_ret = gtk_tree_view_get_model(Handle);
+-				Gtk.TreeModel ret = Gtk.TreeModelAdapter.GetObject (raw_ret, false);
+-				return ret;
+-			}
+-			set  {
+-				var storeHandle = value == null ? IntPtr.Zero : value.Handle;
+-				gtk_tree_view_set_model(Handle, storeHandle);
+-				if (storeHandle != IntPtr.Zero)
+-					g_object_unref (storeHandle);
++		public TreeView (Gtk.TreeModel model) : base (IntPtr.Zero)
++		{
++			if (GetType () != typeof (TreeView)) {
++				var vals = new GLib.Value[1];
++				var names = new IntPtr[1];
++				var param_count = 0;
++				if (model != null) {
++					names[param_count] = GLib.Marshaller.StringToPtrGStrdup ("model");
++					vals[param_count++] = new GLib.Value (model);
++				}
++				CreateNativeObject (names, vals, param_count);
++				return;
+ 			}
++			Raw = gtk_tree_view_new_with_model(model == null ? IntPtr.Zero : model.Handle);
++			if (model != null)
++				g_object_ref (model.Handle);
+ 		}
+ 
+ 		[Obsolete ("Use NodeView with NodeStores")]
diff --git a/debian/patches/series b/debian/patches/series
index 2f5ad56..3370ccf 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,5 @@
 01_dllmaps
 02_pcfiles
 03_missing_gtk-sharp_dllmap_entry
+04_fix_treeview_model_ref
 no-void-cachetype.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-cli-libs/packages/gtk-sharp2.git



More information about the Pkg-cli-libs-commits mailing list