[Pkg-cli-libs-commits] [SCM] gtk-sharp2 branch, master, updated. debian/2.12.10-4-1-gb130b4f
Carlos Martín Nieto
cmn at dwim.me
Sun Sep 2 16:29:53 UTC 2012
The following commit has been merged in the master branch:
commit b130b4f8a79252462a5960461b7b9187fb6307fb
Author: Carlos Martín Nieto <cmn at dwim.me>
Date: Sun Sep 2 18:21:45 2012 +0200
debian/patches: add 06_IconTheme_use_glib_marshaller
This makes IconTheme.get_SearchPath() 64-bit safe.
diff --git a/debian/patches/06_IconTheme_use_glib_marshaller b/debian/patches/06_IconTheme_use_glib_marshaller
new file mode 100644
index 0000000..3a232c1
--- /dev/null
+++ b/debian/patches/06_IconTheme_use_glib_marshaller
@@ -0,0 +1,60 @@
+Description: IconThem: use the glib marshallers Use GLib.Marshaller
+ instead of doing it per hand. This makes IconTheme.get_SearchPath()
+ safe to use in 64-bit machines, as we don't try to make the pointer
+ fit into a Int32.
+Author: Carlos Martín Nieto <cmn at dwim.me>
+
+Index: gtk-sharp2/gtk/IconTheme.custom
+===================================================================
+--- gtk-sharp2.orig/gtk/IconTheme.custom 2012-09-02 18:01:52.000000000 +0200
++++ gtk-sharp2/gtk/IconTheme.custom 2012-09-02 18:01:52.000000000 +0200
+@@ -71,9 +71,6 @@
+
+ public string[] SearchPath {
+ get {
+- string[] retval;
+-
+- unsafe {
+ int length;
+ IntPtr raw_ret;
+ if (IsWindowsPlatform)
+@@ -81,31 +78,22 @@
+ else
+ gtk_icon_theme_get_search_path (Handle, out raw_ret, out length);
+
+- int size = Marshal.SizeOf (typeof (IntPtr));
+- retval = new string[length];
+- for (int i = 0, j = 0; i < length; i++, j += size) {
+- IntPtr string_ptr = Marshal.ReadIntPtr (new IntPtr (raw_ret.ToInt32 () + j));
+- retval[i] = GLib.Marshaller.Utf8PtrToString (string_ptr);
+- }
+-
+- g_strfreev (raw_ret);
+- }
+-
+- return retval;
++ return GLib.Marshaller.NullTermPtrToStringArray(raw_ret, true);
++
+ }
+ set {
+- int cnt_path = value == null ? 0 : value.Length;
+- IntPtr[] native_path = new IntPtr [cnt_path];
+- for (int i = 0; i < cnt_path; i++)
+- native_path [i] = GLib.Marshaller.StringToPtrGStrdup (value[i]);
++ IntPtr[] native_path;
++ if (value == null)
++ native_path = new IntPtr [0];
++ else
++ native_path = GLib.Marshaller.StringArrayToNullTermPointer (value);
+
+ if (IsWindowsPlatform)
+ gtk_icon_theme_set_search_path_utf8 (Handle, native_path, native_path.Length);
+ else
+ gtk_icon_theme_set_search_path (Handle, native_path, native_path.Length);
+
+- for (int i = 0; i < native_path.Length; i++)
+- GLib.Marshaller.Free (native_path[i]);
++ GLib.Marshaller.Free(native_path);
+ }
+ }
+
diff --git a/debian/patches/series b/debian/patches/series
index eb7e3db..747de2b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,4 +2,5 @@
02_pcfiles
04_fix_glib_2.31_threading
05_glib_single_include
+06_IconTheme_use_glib_marshaller
--
gtk-sharp2
More information about the Pkg-cli-libs-commits
mailing list