diff --git a/dotnet/extlibs/csfml-audio.dll b/dotnet/extlibs/csfml-audio.dll index fc371fb7..2d99395e 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 ea86d772..638fa254 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 32cd8a1e..baa48022 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 b7d165e7..cd1fbf62 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 c1fb5296..0582e562 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); }