-
Notifications
You must be signed in to change notification settings - Fork 140
Conversation
7b97e04
to
8e3f2a5
Compare
0caa8fd
to
367262d
Compare
c34e822
to
c61521b
Compare
This, for example, makes parameters available for imported callbacks. Thus, Gtk.Object now implements Atk.Implementor
Avoids codegen of bloat
83ec0c1
to
8c54918
Compare
ea5f08b
to
7fa0084
Compare
831efbe
to
ae7dcdf
Compare
The PR should be ready now. |
Final diff: |
Last version: |
gdk/Display.custom
Outdated
func_list.Add (func_wrapper); | ||
gdk_display_add_client_message_filter (Handle, message_type == null ? IntPtr.Zero : message_type.Handle, func_wrapper.NativeDelegate, IntPtr.Zero); | ||
var gch = GCHandle.Alloc (func); | ||
gdk_display_add_client_message_filter (Handle, message_type == null ? IntPtr.Zero : message_type.Handle, GdkSharp.FilterFuncWrapper.NativeDelegate, (IntPtr)gch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment that this leaks forever and that there is no gdk_display_remove_client_message_filter
to allow cleanup to happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
https://gist.github.com/Therzok/7c79efe0f070277f35c19ef44b9cd770 Latest diff |
hash.Remove (function); | ||
gdk_window_remove_filter (Handle, wrapper.NativeDelegate, IntPtr.Zero); | ||
gdk_window_remove_filter (Handle, GdkSharp.FilterFuncWrapper.NativeDelegate, (IntPtr)gch); | ||
gch.Free(); | ||
} | ||
|
||
#if MANLY_ENOUGH_TO_INCLUDE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, noticed it too
glade/XML.custom
Outdated
} | ||
|
||
gch = GCHandle.Alloc (value); | ||
glade_set_custom_handler(GladeSharp.XMLCustomWidgetHandlerWrapper.NativeDelegate, (IntPtr)gch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to set callback_wrapper
? It'll always be null here, right? Should this be changed to:
- static Glade.XMLCustomWidgetHandler callback_wrapper = null;
...
...
if (gch.IsAllocated)
gch.Free ();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gch.IsAllocated only works after alloc/free, afaik, not with empty gchandle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
gtk/TreeModelFilter.custom
Outdated
@@ -68,7 +68,7 @@ | |||
IntPtr[] native_types = new IntPtr [types.Length]; | |||
for (int i = 0; i < types.Length; i++) | |||
native_types [i] = types [i].Val; | |||
GCHandle gch = GCHandle.Alloc (func); | |||
GCHandle gch = func != null ? GCHandle.Alloc (func) : (GCHandle)IntPtr.Zero; | |||
gtk_tree_model_filter_set_modify_func (Handle, n_columns, native_types, GtkSharp.TreeModelFilterModifyFuncWrapper.NativeDelegate, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to pass a null destroy callback when func is null? It'd be consistent with everything else if we passed a null destroy callback when the func is null, but not a big deal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is there a particular reason why we want to keep passing GtkSharp.TreeModelFilterModifyFuncWrapper.NativeDelegate
to native when the func
is null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DestroyNotify handles null gchandle, so we're ok:
static void ReleaseGCHandle (IntPtr data)
{
if (data == IntPtr.Zero)
return;
GCHandle gch = (GCHandle) data;
gch.Free ();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, maybe not. I can send in null. This was custom bound, didn't verify integrity of it
No description provided.