glib: Fix native GLib warnings when disposing SourceProxy objects
When an instance of SourceProxy was finalized, we would try to remove the corresponding source, even if it was already removed. This now causes native GLib to print out warnings because it can't find the source ID. Now Source.Remove only calls g_source_remove if we really had a handler registered for the ID we're removing.
This commit is contained in:
parent
f5211acb74
commit
7ea0c4afaf
1 changed files with 9 additions and 3 deletions
|
@ -152,9 +152,15 @@ namespace GLib {
|
||||||
|
|
||||||
public static bool Remove (uint tag)
|
public static bool Remove (uint tag)
|
||||||
{
|
{
|
||||||
lock (Source.source_handlers)
|
// g_source_remove always returns true, so we follow that
|
||||||
source_handlers.Remove (tag);
|
bool ret = true;
|
||||||
return g_source_remove (tag);
|
|
||||||
|
lock (Source.source_handlers) {
|
||||||
|
if (source_handlers.Remove (tag)) {
|
||||||
|
ret = g_source_remove (tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
|
Loading…
Reference in a new issue