mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-06-29 07:19:28 +00:00
glib: add missing lock statements for Objects collection
When accessing the static Objects collection in GLib.Object class, a lock was held in some places but not all of them. Brought up by Alan McGovern. Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
This commit is contained in:
parent
b5e0d297bb
commit
61b67120c2
|
@ -87,9 +87,13 @@ namespace GLib {
|
||||||
if (o == IntPtr.Zero)
|
if (o == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ToggleRef tr = (ToggleRef) Objects[o];
|
ToggleRef toggle_ref;
|
||||||
if (tr != null) {
|
lock (Objects) {
|
||||||
return tr.Target;
|
toggle_ref = (ToggleRef) Objects[o];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toggle_ref != null) {
|
||||||
|
return toggle_ref.Target;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -103,9 +107,11 @@ namespace GLib {
|
||||||
Object obj = null;
|
Object obj = null;
|
||||||
|
|
||||||
ToggleRef toggle_ref;
|
ToggleRef toggle_ref;
|
||||||
if (Objects.TryGetValue (o, out toggle_ref)) {
|
lock (Objects) {
|
||||||
if (toggle_ref != null)
|
if (Objects.TryGetValue (o, out toggle_ref)) {
|
||||||
obj = toggle_ref.Target;
|
if (toggle_ref != null)
|
||||||
|
obj = toggle_ref.Target;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj != null && obj.Handle == o) {
|
if (obj != null && obj.Handle == o) {
|
||||||
|
@ -540,17 +546,20 @@ namespace GLib {
|
||||||
if (handle == value)
|
if (handle == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (handle != IntPtr.Zero) {
|
lock (Objects) {
|
||||||
Objects.Remove (handle);
|
if (handle != IntPtr.Zero) {
|
||||||
if (tref != null) {
|
Objects.Remove (handle);
|
||||||
tref.Dispose ();
|
if (tref != null) {
|
||||||
tref = null;
|
tref.Dispose ();
|
||||||
|
tref = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handle = value;
|
||||||
|
if (value != IntPtr.Zero) {
|
||||||
|
tref = new ToggleRef (this);
|
||||||
|
Objects [value] = tref;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
handle = value;
|
|
||||||
if (value != IntPtr.Zero) {
|
|
||||||
tref = new ToggleRef (this);
|
|
||||||
Objects [value] = tref;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue