mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
2006-05-08 Joe Shaw <joeshaw@novell.com>
* glib/ValueArray.cs: Don't immediately free ValueArrays; queue them up to be freed in the main thread by using a Timeout. This fixes SMP deadlocks when the GValues contained therein aren't threadsafe (like GDK resources). Fixes Novell bug #168650. svn path=/trunk/gtk-sharp/; revision=60424
This commit is contained in:
parent
9074d1e9e4
commit
a199215947
@ -1,3 +1,10 @@
|
|||||||
|
2006-05-08 Joe Shaw <joeshaw@novell.com>
|
||||||
|
|
||||||
|
* glib/ValueArray.cs: Don't immediately free ValueArrays; queue
|
||||||
|
them up to be freed in the main thread by using a Timeout. This
|
||||||
|
fixes SMP deadlocks when the GValues contained therein aren't
|
||||||
|
threadsafe (like GDK resources). Fixes Novell bug #168650.
|
||||||
|
|
||||||
2006-05-04 Peter Johanson <peter@peterjohanson.com>
|
2006-05-04 Peter Johanson <peter@peterjohanson.com>
|
||||||
|
|
||||||
* gtk/glue/cellrenderer.c: Revert r59683, as it causes issues for
|
* gtk/glue/cellrenderer.c: Revert r59683, as it causes issues for
|
||||||
|
@ -29,6 +29,9 @@ namespace GLib {
|
|||||||
|
|
||||||
private IntPtr handle = IntPtr.Zero;
|
private IntPtr handle = IntPtr.Zero;
|
||||||
|
|
||||||
|
static private ArrayList PendingFrees = new ArrayList ();
|
||||||
|
static private bool idle_queued = false;
|
||||||
|
|
||||||
[DllImport("libgobject-2.0-0.dll")]
|
[DllImport("libgobject-2.0-0.dll")]
|
||||||
static extern IntPtr g_value_array_new (uint n_preallocs);
|
static extern IntPtr g_value_array_new (uint n_preallocs);
|
||||||
|
|
||||||
@ -62,9 +65,35 @@ namespace GLib {
|
|||||||
if (Handle == IntPtr.Zero)
|
if (Handle == IntPtr.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_value_array_free (Handle);
|
lock (PendingFrees) {
|
||||||
|
PendingFrees.Add (handle);
|
||||||
|
|
||||||
|
if (! idle_queued) {
|
||||||
|
Timeout.Add (50, new TimeoutHandler (PerformFrees));
|
||||||
|
idle_queued = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handle = IntPtr.Zero;
|
handle = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool PerformFrees ()
|
||||||
|
{
|
||||||
|
IntPtr[] handles;
|
||||||
|
|
||||||
|
lock (PendingFrees) {
|
||||||
|
idle_queued = false;
|
||||||
|
|
||||||
|
handles = new IntPtr [PendingFrees.Count];
|
||||||
|
PendingFrees.CopyTo (handles, 0);
|
||||||
|
PendingFrees.Clear ();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (IntPtr h in handles)
|
||||||
|
g_value_array_free (h);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public IntPtr Handle {
|
public IntPtr Handle {
|
||||||
get {
|
get {
|
||||||
|
Loading…
Reference in New Issue
Block a user