diff --git a/dotnet/extlibs/csfml-audio.dll b/dotnet/extlibs/csfml-audio.dll index fc371fb7d..2d99395eb 100644 Binary files a/dotnet/extlibs/csfml-audio.dll and b/dotnet/extlibs/csfml-audio.dll differ diff --git a/dotnet/extlibs/csfml-graphics.dll b/dotnet/extlibs/csfml-graphics.dll index ea86d7721..638fa2544 100644 Binary files a/dotnet/extlibs/csfml-graphics.dll and b/dotnet/extlibs/csfml-graphics.dll differ diff --git a/dotnet/extlibs/csfml-window.dll b/dotnet/extlibs/csfml-window.dll index 32cd8a1e1..baa480221 100644 Binary files a/dotnet/extlibs/csfml-window.dll and b/dotnet/extlibs/csfml-window.dll differ diff --git a/include/SFML/System/Resource.hpp b/include/SFML/System/Resource.hpp index b7d165e70..cd1fbf621 100644 --- a/include/SFML/System/Resource.hpp +++ b/include/SFML/System/Resource.hpp @@ -28,6 +28,8 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include +#include #include @@ -111,7 +113,8 @@ private : //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - mutable std::set*> myObservers; + mutable std::set*> myObservers; ///< List of pointers to this resource + mutable Mutex myMutex; ///< Mutex for preventing concurrent access to the pointer list }; diff --git a/include/SFML/System/Resource.inl b/include/SFML/System/Resource.inl index c1fb52968..0582e5625 100644 --- a/include/SFML/System/Resource.inl +++ b/include/SFML/System/Resource.inl @@ -64,6 +64,7 @@ Resource& Resource::operator =(const Resource&) template void Resource::Connect(ResourcePtr& observer) const { + sf::Lock lock(myMutex); myObservers.insert(&observer); } @@ -72,5 +73,6 @@ void Resource::Connect(ResourcePtr& observer) const template void Resource::Disconnect(ResourcePtr& observer) const { + sf::Lock lock(myMutex); myObservers.erase(&observer); }