From f3c028e5d23b60bb1b94b941d40448e3f19eb22f Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Fri, 25 Jan 2008 10:20:25 +0000 Subject: [PATCH] Lock in constructor for thread safety. --- Source/OpenTK/Graphics/DisplayDevice.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/OpenTK/Graphics/DisplayDevice.cs b/Source/OpenTK/Graphics/DisplayDevice.cs index 4b5bcd2d..73095729 100644 --- a/Source/OpenTK/Graphics/DisplayDevice.cs +++ b/Source/OpenTK/Graphics/DisplayDevice.cs @@ -69,9 +69,13 @@ namespace OpenTK.Graphics this.current_resolution = currentResolution; this.primary = primary; this.available_resolutions.AddRange(availableResolutions); - available_displays.Add(this); - if (primary) - primary_display = this; + + lock (display_lock) + { + available_displays.Add(this); + if (primary) + primary_display = this; + } } #endregion