Closed Therzok closed 8 years ago
…passed by value
In the case of TreeStore.GetValue, the generated code would try to assign iter to the value that was marshalled back from native.
This behaviour is incorrect, as the struct was passed by value, and discarded, having no effect on the code-flow but useless overhead.
public void GetValue(Gtk.TreeIter, 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); // The line below is removed. native_iter = TreeIter.New (native_iter); Marshal.FreeHGlobal (native_iter); value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value)); Marshal.FreeHGlobal (native_value); }
/cc @DavidKarlas
The full diff https://gist.github.com/Therzok/22ebd51501225e108099fd5d59e6b0b2
Awesome job!
Yeah definitely, can you guys port to master? :)
I'm doing that now.
658f2e2eb5833807e4d54c7f6b90a681afd112dc
…passed by value
In the case of TreeStore.GetValue, the generated code would try to assign iter to the value that was marshalled back from native.
This behaviour is incorrect, as the struct was passed by value, and discarded, having no effect on the code-flow but useless overhead.