Skip to content

Instantly share code, notes, and snippets.

@Therzok
Last active July 21, 2016 15:28
Show Gist options
  • Save Therzok/f0627b87a5f89c1e3e5b2aab58b59b08 to your computer and use it in GitHub Desktop.
Save Therzok/f0627b87a5f89c1e3e5b2aab58b59b08 to your computer and use it in GitHub Desktop.
Gtk# Generator Change byref
diff --git b/atk/generated/NoOpObject.cs a/atk/generated/NoOpObject.cs
index 59dd220..5b99b26 100644
--- b/atk/generated/NoOpObject.cs
+++ a/atk/generated/NoOpObject.cs
@@ -948,54 +948,40 @@ namespace Atk {
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void atk_value_get_minimum_value(IntPtr raw, IntPtr value);
+ static extern void atk_value_get_minimum_value(IntPtr raw, ref GLib.Value value);
public void GetMinimumValue(ref GLib.Value value) {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- atk_value_get_minimum_value(Handle, native_value);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
+ atk_value_get_minimum_value(Handle, ref value);
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern bool atk_value_set_current_value(IntPtr raw, IntPtr value);
+ static extern bool atk_value_set_current_value(IntPtr raw, ref GLib.Value value);
public bool SetCurrentValue(GLib.Value value) {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- bool raw_ret = atk_value_set_current_value(Handle, native_value);
+ bool raw_ret = atk_value_set_current_value(Handle, ref value);
bool ret = raw_ret;
- Marshal.FreeHGlobal (native_value);
return ret;
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void atk_value_get_maximum_value(IntPtr raw, IntPtr value);
+ static extern void atk_value_get_maximum_value(IntPtr raw, ref GLib.Value value);
public void GetMaximumValue(ref GLib.Value value) {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- atk_value_get_maximum_value(Handle, native_value);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
+ atk_value_get_maximum_value(Handle, ref value);
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void atk_value_get_minimum_increment(IntPtr raw, IntPtr value);
+ static extern void atk_value_get_minimum_increment(IntPtr raw, ref GLib.Value value);
public void GetMinimumIncrement(ref GLib.Value value) {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- atk_value_get_minimum_increment(Handle, native_value);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
+ atk_value_get_minimum_increment(Handle, ref value);
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void atk_value_get_current_value(IntPtr raw, IntPtr value);
+ static extern void atk_value_get_current_value(IntPtr raw, ref GLib.Value value);
public void GetCurrentValue(ref GLib.Value value) {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- atk_value_get_current_value(Handle, native_value);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
+ atk_value_get_current_value(Handle, ref value);
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git b/atk/generated/ValueAdapter.cs a/atk/generated/ValueAdapter.cs
index f76c55c..599c4a5 100644
--- b/atk/generated/ValueAdapter.cs
+++ a/atk/generated/ValueAdapter.cs
@@ -34,58 +34,52 @@ namespace Atk {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- delegate void GetCurrentValueDelegate (IntPtr obj, IntPtr value);
+ delegate void GetCurrentValueDelegate (IntPtr obj, ref GLib.Value value);
- static void GetCurrentValueCallback (IntPtr obj, IntPtr value)
+ static void GetCurrentValueCallback (IntPtr obj, ref GLib.Value value)
{
try {
Atk.ValueImplementor __obj = GLib.Object.GetObject (obj, false) as Atk.ValueImplementor;
- GLib.Value myvalue = (GLib.Value) Marshal.PtrToStructure (value, typeof (GLib.Value));
- __obj.GetCurrentValue (ref myvalue);
- if (value != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (myvalue, value, false);
+ __obj.GetCurrentValue (ref value);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- delegate void GetMaximumValueDelegate (IntPtr obj, IntPtr value);
+ delegate void GetMaximumValueDelegate (IntPtr obj, ref GLib.Value value);
- static void GetMaximumValueCallback (IntPtr obj, IntPtr value)
+ static void GetMaximumValueCallback (IntPtr obj, ref GLib.Value value)
{
try {
Atk.ValueImplementor __obj = GLib.Object.GetObject (obj, false) as Atk.ValueImplementor;
- GLib.Value myvalue = (GLib.Value) Marshal.PtrToStructure (value, typeof (GLib.Value));
- __obj.GetMaximumValue (ref myvalue);
- if (value != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (myvalue, value, false);
+ __obj.GetMaximumValue (ref value);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- delegate void GetMinimumValueDelegate (IntPtr obj, IntPtr value);
+ delegate void GetMinimumValueDelegate (IntPtr obj, ref GLib.Value value);
- static void GetMinimumValueCallback (IntPtr obj, IntPtr value)
+ static void GetMinimumValueCallback (IntPtr obj, ref GLib.Value value)
{
try {
Atk.ValueImplementor __obj = GLib.Object.GetObject (obj, false) as Atk.ValueImplementor;
- GLib.Value myvalue = (GLib.Value) Marshal.PtrToStructure (value, typeof (GLib.Value));
- __obj.GetMinimumValue (ref myvalue);
- if (value != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (myvalue, value, false);
+ __obj.GetMinimumValue (ref value);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- delegate bool SetCurrentValueDelegate (IntPtr obj, IntPtr value);
+ delegate bool SetCurrentValueDelegate (IntPtr obj, ref GLib.Value value);
- static bool SetCurrentValueCallback (IntPtr obj, IntPtr value)
+ static bool SetCurrentValueCallback (IntPtr obj, ref GLib.Value value)
{
try {
Atk.ValueImplementor __obj = GLib.Object.GetObject (obj, false) as Atk.ValueImplementor;
- bool __result = __obj.SetCurrentValue ((GLib.Value) Marshal.PtrToStructure (value, typeof (GLib.Value)));
+ bool __result = __obj.SetCurrentValue (value);
return __result;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -95,15 +89,13 @@ namespace Atk {
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- delegate void GetMinimumIncrementDelegate (IntPtr obj, IntPtr value);
+ delegate void GetMinimumIncrementDelegate (IntPtr obj, ref GLib.Value value);
- static void GetMinimumIncrementCallback (IntPtr obj, IntPtr value)
+ static void GetMinimumIncrementCallback (IntPtr obj, ref GLib.Value value)
{
try {
Atk.ValueImplementor __obj = GLib.Object.GetObject (obj, false) as Atk.ValueImplementor;
- GLib.Value myvalue = (GLib.Value) Marshal.PtrToStructure (value, typeof (GLib.Value));
- __obj.GetMinimumIncrement (ref myvalue);
- if (value != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (myvalue, value, false);
+ __obj.GetMinimumIncrement (ref value);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
@@ -185,54 +177,40 @@ namespace Atk {
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void atk_value_get_minimum_value(IntPtr raw, IntPtr value);
+ static extern void atk_value_get_minimum_value(IntPtr raw, ref GLib.Value value);
public void GetMinimumValue(ref GLib.Value value) {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- atk_value_get_minimum_value(Handle, native_value);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
+ atk_value_get_minimum_value(Handle, ref value);
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern bool atk_value_set_current_value(IntPtr raw, IntPtr value);
+ static extern bool atk_value_set_current_value(IntPtr raw, ref GLib.Value value);
public bool SetCurrentValue(GLib.Value value) {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- bool raw_ret = atk_value_set_current_value(Handle, native_value);
+ bool raw_ret = atk_value_set_current_value(Handle, ref value);
bool ret = raw_ret;
- Marshal.FreeHGlobal (native_value);
return ret;
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void atk_value_get_maximum_value(IntPtr raw, IntPtr value);
+ static extern void atk_value_get_maximum_value(IntPtr raw, ref GLib.Value value);
public void GetMaximumValue(ref GLib.Value value) {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- atk_value_get_maximum_value(Handle, native_value);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
+ atk_value_get_maximum_value(Handle, ref value);
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void atk_value_get_minimum_increment(IntPtr raw, IntPtr value);
+ static extern void atk_value_get_minimum_increment(IntPtr raw, ref GLib.Value value);
public void GetMinimumIncrement(ref GLib.Value value) {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- atk_value_get_minimum_increment(Handle, native_value);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
+ atk_value_get_minimum_increment(Handle, ref value);
}
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void atk_value_get_current_value(IntPtr raw, IntPtr value);
+ static extern void atk_value_get_current_value(IntPtr raw, ref GLib.Value value);
public void GetCurrentValue(ref GLib.Value value) {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- atk_value_get_current_value(Handle, native_value);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
+ atk_value_get_current_value(Handle, ref value);
}
#endregion
diff --git b/gdk/generated/Global.cs a/gdk/generated/Global.cs
index 560c51c..c92f749 100644
--- b/gdk/generated/Global.cs
+++ a/gdk/generated/Global.cs
@@ -142,15 +142,13 @@ namespace Gdk {
}
[DllImport("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern bool gdk_setting_get(IntPtr name, IntPtr value);
+ static extern bool gdk_setting_get(IntPtr name, ref GLib.Value value);
public static bool SettingGet(string name, GLib.Value value) {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- bool raw_ret = gdk_setting_get(native_name, native_value);
+ bool raw_ret = gdk_setting_get(native_name, ref value);
bool ret = raw_ret;
GLib.Marshaller.Free (native_name);
- Marshal.FreeHGlobal (native_value);
return ret;
}
diff --git b/gdk/generated/Screen.cs a/gdk/generated/Screen.cs
index b25ab65..b963c9e 100644
--- b/gdk/generated/Screen.cs
+++ a/gdk/generated/Screen.cs
@@ -369,15 +369,13 @@ namespace Gdk {
}
[DllImport("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern bool gdk_screen_get_setting(IntPtr raw, IntPtr name, IntPtr value);
+ static extern bool gdk_screen_get_setting(IntPtr raw, IntPtr name, ref GLib.Value value);
public bool GetSetting(string name, GLib.Value value) {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- bool raw_ret = gdk_screen_get_setting(Handle, native_name, native_value);
+ bool raw_ret = gdk_screen_get_setting(Handle, native_name, ref value);
bool ret = raw_ret;
GLib.Marshaller.Free (native_name);
- Marshal.FreeHGlobal (native_value);
return ret;
}
diff --git b/gtk/generated/Container.cs a/gtk/generated/Container.cs
index 5cc0dd0..4a03e40 100644
--- b/gtk/generated/Container.cs
+++ a/gtk/generated/Container.cs
@@ -351,14 +351,12 @@ namespace Gtk {
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gtk_container_child_set_property(IntPtr raw, IntPtr child, IntPtr property_name, IntPtr value);
+ static extern void gtk_container_child_set_property(IntPtr raw, IntPtr child, IntPtr property_name, ref GLib.Value value);
public void ChildSetProperty(Gtk.Widget child, string property_name, GLib.Value value) {
IntPtr native_property_name = GLib.Marshaller.StringToPtrGStrdup (property_name);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- gtk_container_child_set_property(Handle, child == null ? IntPtr.Zero : child.Handle, native_property_name, native_value);
+ gtk_container_child_set_property(Handle, child == null ? IntPtr.Zero : child.Handle, native_property_name, ref value);
GLib.Marshaller.Free (native_property_name);
- Marshal.FreeHGlobal (native_value);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git b/gtk/generated/GtkSharp.RcPropertyParserNative.cs a/gtk/generated/GtkSharp.RcPropertyParserNative.cs
index 951047b..5e24f64 100644
--- b/gtk/generated/GtkSharp.RcPropertyParserNative.cs
+++ a/gtk/generated/GtkSharp.RcPropertyParserNative.cs
@@ -8,7 +8,7 @@ namespace GtkSharp {
#region Autogenerated code
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- internal delegate bool RcPropertyParserNative(IntPtr pspec, IntPtr rc_string, IntPtr property_value);
+ internal delegate bool RcPropertyParserNative(IntPtr pspec, IntPtr rc_string, ref GLib.Value property_value);
internal class RcPropertyParserInvoker {
@@ -42,19 +42,17 @@ namespace GtkSharp {
bool InvokeNative (IntPtr pspec, string rc_string, GLib.Value property_value)
{
- IntPtr native_property_value = GLib.Marshaller.StructureToPtrAlloc (property_value);
- bool result = native_cb (pspec, new GLib.GString (rc_string).Handle, native_property_value);
- Marshal.FreeHGlobal (native_property_value);
+ bool result = native_cb (pspec, new GLib.GString (rc_string).Handle, ref property_value);
return result;
}
}
internal class RcPropertyParserWrapper {
- public bool NativeCallback (IntPtr pspec, IntPtr rc_string, IntPtr property_value)
+ public bool NativeCallback (IntPtr pspec, IntPtr rc_string, ref GLib.Value property_value)
{
try {
- bool __ret = managed (pspec, GLib.GString.PtrToString (rc_string), (GLib.Value) Marshal.PtrToStructure (property_value, typeof (GLib.Value)));
+ bool __ret = managed (pspec, GLib.GString.PtrToString (rc_string), property_value);
if (release_on_call)
gch.Free ();
return __ret;
diff --git b/gtk/generated/GtkSharp.TreeModelFilterModifyFuncNative.cs a/gtk/generated/GtkSharp.TreeModelFilterModifyFuncNative.cs
index fccc014..d9ddb9a 100644
--- b/gtk/generated/GtkSharp.TreeModelFilterModifyFuncNative.cs
+++ a/gtk/generated/GtkSharp.TreeModelFilterModifyFuncNative.cs
@@ -8,7 +8,7 @@ namespace GtkSharp {
#region Autogenerated code
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- internal delegate void TreeModelFilterModifyFuncNative(IntPtr model, IntPtr iter, IntPtr value, int column, IntPtr data);
+ internal delegate void TreeModelFilterModifyFuncNative(IntPtr model, IntPtr iter, ref GLib.Value value, int column, IntPtr data);
internal class TreeModelFilterModifyFuncInvoker {
@@ -43,24 +43,17 @@ namespace GtkSharp {
void InvokeNative (Gtk.TreeModel model, Gtk.TreeIter iter, ref GLib.Value value, int column)
{
IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- native_cb (model == null ? IntPtr.Zero : model.Handle, native_iter, native_value, column, __data);
+ native_cb (model == null ? IntPtr.Zero : model.Handle, native_iter, ref value, column, __data);
Marshal.FreeHGlobal (native_iter);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
}
}
internal class TreeModelFilterModifyFuncWrapper {
- public void NativeCallback (IntPtr model, IntPtr iter, IntPtr value, int column, IntPtr data)
+ public void NativeCallback (IntPtr model, IntPtr iter, ref GLib.Value value, int column, IntPtr data)
{
try {
- GLib.Value myvalue = (GLib.Value) Marshal.PtrToStructure (value, typeof (GLib.Value));
-
- managed (Gtk.TreeModelAdapter.GetObject (model, false), Gtk.TreeIter.New (iter), ref myvalue, column);
- if (value != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (myvalue, value, false);
-
+ managed (Gtk.TreeModelAdapter.GetObject (model, false), Gtk.TreeIter.New (iter), ref value, column);
if (release_on_call)
gch.Free ();
} catch (Exception e) {
diff --git b/gtk/generated/ListStore.cs a/gtk/generated/ListStore.cs
index d9182c8..52217ac 100644
--- b/gtk/generated/ListStore.cs
+++ a/gtk/generated/ListStore.cs
@@ -73,28 +73,24 @@ namespace Gtk {
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gtk_list_store_insert_with_valuesv(IntPtr raw, IntPtr iter, int position, out int columns, IntPtr values, int n_values);
+ static extern void gtk_list_store_insert_with_valuesv(IntPtr raw, IntPtr iter, int position, out int columns, ref GLib.Value values, int n_values);
[Obsolete]
public int InsertWithValuesv(Gtk.TreeIter iter, int position, GLib.Value values, int n_values) {
int columns;
IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
- IntPtr native_values = GLib.Marshaller.StructureToPtrAlloc (values);
- gtk_list_store_insert_with_valuesv(Handle, native_iter, position, out columns, native_values, n_values);
+ gtk_list_store_insert_with_valuesv(Handle, native_iter, position, out columns, ref values, n_values);
Marshal.FreeHGlobal (native_iter);
- Marshal.FreeHGlobal (native_values);
return columns;
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gtk_list_store_set_value(IntPtr raw, IntPtr iter, int column, IntPtr value);
+ static extern void gtk_list_store_set_value(IntPtr raw, IntPtr iter, int column, ref GLib.Value value);
public void SetValue(Gtk.TreeIter iter, int column, GLib.Value value) {
IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- gtk_list_store_set_value(Handle, native_iter, column, native_value);
+ gtk_list_store_set_value(Handle, native_iter, column, ref value);
Marshal.FreeHGlobal (native_iter);
- Marshal.FreeHGlobal (native_value);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -265,15 +261,12 @@ namespace Gtk {
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gtk_tree_model_get_value(IntPtr raw, IntPtr iter, int column, IntPtr value);
+ static extern void gtk_tree_model_get_value(IntPtr raw, IntPtr iter, int column, ref GLib.Value value);
public void GetValue(Gtk.TreeIter iter, int column, ref GLib.Value value) {
IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- gtk_tree_model_get_value(Handle, native_iter, column, native_value);
+ gtk_tree_model_get_value(Handle, native_iter, column, ref value);
Marshal.FreeHGlobal (native_iter);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git b/gtk/generated/RcProperty.cs a/gtk/generated/RcProperty.cs
index 0c79a81..8c07453 100644
--- b/gtk/generated/RcProperty.cs
+++ a/gtk/generated/RcProperty.cs
@@ -25,57 +25,47 @@ namespace Gtk {
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern bool gtk_rc_property_parse_enum(IntPtr pspec, IntPtr gstring, IntPtr property_value);
+ static extern bool gtk_rc_property_parse_enum(IntPtr pspec, IntPtr gstring, ref GLib.Value property_value);
public static bool ParseEnum(IntPtr pspec, string gstring, GLib.Value property_value) {
- IntPtr native_property_value = GLib.Marshaller.StructureToPtrAlloc (property_value);
- bool raw_ret = gtk_rc_property_parse_enum(pspec, new GLib.GString (gstring).Handle, native_property_value);
+ bool raw_ret = gtk_rc_property_parse_enum(pspec, new GLib.GString (gstring).Handle, ref property_value);
bool ret = raw_ret;
- Marshal.FreeHGlobal (native_property_value);
return ret;
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern bool gtk_rc_property_parse_border(IntPtr pspec, IntPtr gstring, IntPtr property_value);
+ static extern bool gtk_rc_property_parse_border(IntPtr pspec, IntPtr gstring, ref GLib.Value property_value);
public static bool ParseBorder(IntPtr pspec, string gstring, GLib.Value property_value) {
- IntPtr native_property_value = GLib.Marshaller.StructureToPtrAlloc (property_value);
- bool raw_ret = gtk_rc_property_parse_border(pspec, new GLib.GString (gstring).Handle, native_property_value);
+ bool raw_ret = gtk_rc_property_parse_border(pspec, new GLib.GString (gstring).Handle, ref property_value);
bool ret = raw_ret;
- Marshal.FreeHGlobal (native_property_value);
return ret;
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern bool gtk_rc_property_parse_color(IntPtr pspec, IntPtr gstring, IntPtr property_value);
+ static extern bool gtk_rc_property_parse_color(IntPtr pspec, IntPtr gstring, ref GLib.Value property_value);
public static bool ParseColor(IntPtr pspec, string gstring, GLib.Value property_value) {
- IntPtr native_property_value = GLib.Marshaller.StructureToPtrAlloc (property_value);
- bool raw_ret = gtk_rc_property_parse_color(pspec, new GLib.GString (gstring).Handle, native_property_value);
+ bool raw_ret = gtk_rc_property_parse_color(pspec, new GLib.GString (gstring).Handle, ref property_value);
bool ret = raw_ret;
- Marshal.FreeHGlobal (native_property_value);
return ret;
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern bool gtk_rc_property_parse_requisition(IntPtr pspec, IntPtr gstring, IntPtr property_value);
+ static extern bool gtk_rc_property_parse_requisition(IntPtr pspec, IntPtr gstring, ref GLib.Value property_value);
public static bool ParseRequisition(IntPtr pspec, string gstring, GLib.Value property_value) {
- IntPtr native_property_value = GLib.Marshaller.StructureToPtrAlloc (property_value);
- bool raw_ret = gtk_rc_property_parse_requisition(pspec, new GLib.GString (gstring).Handle, native_property_value);
+ bool raw_ret = gtk_rc_property_parse_requisition(pspec, new GLib.GString (gstring).Handle, ref property_value);
bool ret = raw_ret;
- Marshal.FreeHGlobal (native_property_value);
return ret;
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern bool gtk_rc_property_parse_flags(IntPtr pspec, IntPtr gstring, IntPtr property_value);
+ static extern bool gtk_rc_property_parse_flags(IntPtr pspec, IntPtr gstring, ref GLib.Value property_value);
public static bool ParseFlags(IntPtr pspec, string gstring, GLib.Value property_value) {
- IntPtr native_property_value = GLib.Marshaller.StructureToPtrAlloc (property_value);
- bool raw_ret = gtk_rc_property_parse_flags(pspec, new GLib.GString (gstring).Handle, native_property_value);
+ bool raw_ret = gtk_rc_property_parse_flags(pspec, new GLib.GString (gstring).Handle, ref property_value);
bool ret = raw_ret;
- Marshal.FreeHGlobal (native_property_value);
return ret;
}
diff --git b/gtk/generated/TreeModelAdapter.cs a/gtk/generated/TreeModelAdapter.cs
index 481d5b2..fa40fd8 100644
--- b/gtk/generated/TreeModelAdapter.cs
+++ a/gtk/generated/TreeModelAdapter.cs
@@ -139,15 +139,13 @@ namespace Gtk {
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- delegate void GetValueDelegate (IntPtr tree_model, IntPtr iter, int column, IntPtr value);
+ delegate void GetValueDelegate (IntPtr tree_model, IntPtr iter, int column, ref GLib.Value value);
- static void GetValueCallback (IntPtr tree_model, IntPtr iter, int column, IntPtr value)
+ static void GetValueCallback (IntPtr tree_model, IntPtr iter, int column, ref GLib.Value value)
{
try {
Gtk.TreeModelImplementor __obj = GLib.Object.GetObject (tree_model, false) as Gtk.TreeModelImplementor;
- GLib.Value myvalue = (GLib.Value) Marshal.PtrToStructure (value, typeof (GLib.Value));
- __obj.GetValue (Gtk.TreeIter.New (iter), column, ref myvalue);
- if (value != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (myvalue, value, false);
+ __obj.GetValue (Gtk.TreeIter.New (iter), column, ref value);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
@@ -469,15 +467,12 @@ namespace Gtk {
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gtk_tree_model_get_value(IntPtr raw, IntPtr iter, int column, IntPtr value);
+ static extern void gtk_tree_model_get_value(IntPtr raw, IntPtr iter, int column, ref GLib.Value value);
public void GetValue(Gtk.TreeIter iter, int column, ref GLib.Value value) {
IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- gtk_tree_model_get_value(Handle, native_iter, column, native_value);
+ gtk_tree_model_get_value(Handle, native_iter, column, ref value);
Marshal.FreeHGlobal (native_iter);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git b/gtk/generated/TreeModelFilter.cs a/gtk/generated/TreeModelFilter.cs
index 69dd69b..9f96bec 100644
--- b/gtk/generated/TreeModelFilter.cs
+++ a/gtk/generated/TreeModelFilter.cs
@@ -206,15 +206,12 @@ namespace Gtk {
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gtk_tree_model_get_value(IntPtr raw, IntPtr iter, int column, IntPtr value);
+ static extern void gtk_tree_model_get_value(IntPtr raw, IntPtr iter, int column, ref GLib.Value value);
public void GetValue(Gtk.TreeIter iter, int column, ref GLib.Value value) {
IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- gtk_tree_model_get_value(Handle, native_iter, column, native_value);
+ gtk_tree_model_get_value(Handle, native_iter, column, ref value);
Marshal.FreeHGlobal (native_iter);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git b/gtk/generated/TreeModelSort.cs a/gtk/generated/TreeModelSort.cs
index 3d1de40..1e83254 100644
--- b/gtk/generated/TreeModelSort.cs
+++ a/gtk/generated/TreeModelSort.cs
@@ -180,15 +180,12 @@ namespace Gtk {
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gtk_tree_model_get_value(IntPtr raw, IntPtr iter, int column, IntPtr value);
+ static extern void gtk_tree_model_get_value(IntPtr raw, IntPtr iter, int column, ref GLib.Value value);
public void GetValue(Gtk.TreeIter iter, int column, ref GLib.Value value) {
IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- gtk_tree_model_get_value(Handle, native_iter, column, native_value);
+ gtk_tree_model_get_value(Handle, native_iter, column, ref value);
Marshal.FreeHGlobal (native_iter);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git b/gtk/generated/TreeStore.cs a/gtk/generated/TreeStore.cs
index a0ede90..30ee666 100644
--- b/gtk/generated/TreeStore.cs
+++ a/gtk/generated/TreeStore.cs
@@ -20,14 +20,12 @@ namespace Gtk {
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gtk_tree_store_set_value(IntPtr raw, IntPtr iter, int column, IntPtr value);
+ static extern void gtk_tree_store_set_value(IntPtr raw, IntPtr iter, int column, ref GLib.Value value);
public void SetValue(Gtk.TreeIter iter, int column, GLib.Value value) {
IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- gtk_tree_store_set_value(Handle, native_iter, column, native_value);
+ gtk_tree_store_set_value(Handle, native_iter, column, ref value);
Marshal.FreeHGlobal (native_iter);
- Marshal.FreeHGlobal (native_value);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -215,15 +213,12 @@ namespace Gtk {
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gtk_tree_model_get_value(IntPtr raw, IntPtr iter, int column, IntPtr value);
+ static extern void gtk_tree_model_get_value(IntPtr raw, IntPtr iter, int column, ref GLib.Value value);
public void GetValue(Gtk.TreeIter iter, int column, ref GLib.Value value) {
IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
- gtk_tree_model_get_value(Handle, native_iter, column, native_value);
+ gtk_tree_model_get_value(Handle, native_iter, column, ref value);
Marshal.FreeHGlobal (native_iter);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@bratsche
Copy link

🎆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment