mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-06-29 11:09: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,10 +107,12 @@ namespace GLib {
|
||||||
Object obj = null;
|
Object obj = null;
|
||||||
|
|
||||||
ToggleRef toggle_ref;
|
ToggleRef toggle_ref;
|
||||||
|
lock (Objects) {
|
||||||
if (Objects.TryGetValue (o, out toggle_ref)) {
|
if (Objects.TryGetValue (o, out toggle_ref)) {
|
||||||
if (toggle_ref != null)
|
if (toggle_ref != null)
|
||||||
obj = toggle_ref.Target;
|
obj = toggle_ref.Target;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (obj != null && obj.Handle == o) {
|
if (obj != null && obj.Handle == o) {
|
||||||
if (owned_ref)
|
if (owned_ref)
|
||||||
|
@ -540,6 +546,7 @@ namespace GLib {
|
||||||
if (handle == value)
|
if (handle == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
lock (Objects) {
|
||||||
if (handle != IntPtr.Zero) {
|
if (handle != IntPtr.Zero) {
|
||||||
Objects.Remove (handle);
|
Objects.Remove (handle);
|
||||||
if (tref != null) {
|
if (tref != null) {
|
||||||
|
@ -547,6 +554,7 @@ namespace GLib {
|
||||||
tref = null;
|
tref = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = value;
|
handle = value;
|
||||||
if (value != IntPtr.Zero) {
|
if (value != IntPtr.Zero) {
|
||||||
tref = new ToggleRef (this);
|
tref = new ToggleRef (this);
|
||||||
|
@ -554,6 +562,7 @@ namespace GLib {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static GLib.GType GType {
|
public static GLib.GType GType {
|
||||||
get { return GType.Object; }
|
get { return GType.Object; }
|
||||||
|
|
Loading…
Reference in a new issue