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