Remove source delegates by id.
* glib/Idle.cs: use g_source_remove and id in Remove(Delegate) * glib/Timeout.cs: use g_source_remove and id in Remove(Delegate) [Fixes #632765]
This commit is contained in:
parent
aae2b05300
commit
6fbd419c1d
2 changed files with 8 additions and 8 deletions
|
@ -27,7 +27,7 @@
|
||||||
namespace GLib {
|
namespace GLib {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public delegate bool IdleHandler ();
|
public delegate bool IdleHandler ();
|
||||||
|
@ -116,7 +116,7 @@ namespace GLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport ("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport ("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
static extern bool g_source_remove_by_funcs_user_data (Delegate d, IntPtr data);
|
static extern bool g_source_remove (uint id);
|
||||||
|
|
||||||
public static void Remove (uint id)
|
public static void Remove (uint id)
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,7 @@ namespace GLib {
|
||||||
public static bool Remove (IdleHandler hndlr)
|
public static bool Remove (IdleHandler hndlr)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
ArrayList keys = new ArrayList ();
|
List<uint> keys = new List<uint> ();
|
||||||
|
|
||||||
lock (Source.source_handlers) {
|
lock (Source.source_handlers) {
|
||||||
foreach (uint code in Source.source_handlers.Keys) {
|
foreach (uint code in Source.source_handlers.Keys) {
|
||||||
|
@ -134,7 +134,7 @@ namespace GLib {
|
||||||
|
|
||||||
if (p != null && p.real_handler == hndlr) {
|
if (p != null && p.real_handler == hndlr) {
|
||||||
keys.Add (code);
|
keys.Add (code);
|
||||||
result = g_source_remove_by_funcs_user_data (p.proxy_handler, IntPtr.Zero);
|
result = g_source_remove (code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
namespace GLib {
|
namespace GLib {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public delegate bool TimeoutHandler ();
|
public delegate bool TimeoutHandler ();
|
||||||
|
@ -131,12 +131,12 @@ namespace GLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport ("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport ("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
static extern bool g_source_remove_by_funcs_user_data (Delegate d, IntPtr data);
|
static extern bool g_source_remove (uint id);
|
||||||
|
|
||||||
public static bool Remove (TimeoutHandler hndlr)
|
public static bool Remove (TimeoutHandler hndlr)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
ArrayList keys = new ArrayList ();
|
List<uint> keys = new List<uint> ();
|
||||||
|
|
||||||
lock (Source.source_handlers) {
|
lock (Source.source_handlers) {
|
||||||
foreach (uint code in Source.source_handlers.Keys) {
|
foreach (uint code in Source.source_handlers.Keys) {
|
||||||
|
@ -144,7 +144,7 @@ namespace GLib {
|
||||||
|
|
||||||
if (p != null && p.real_handler == hndlr) {
|
if (p != null && p.real_handler == hndlr) {
|
||||||
keys.Add (code);
|
keys.Add (code);
|
||||||
result = g_source_remove_by_funcs_user_data (p.proxy_handler, IntPtr.Zero);
|
result = g_source_remove (code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue