Thanks for the update. Trying out the updated branch, I still run into a deadlock, but in a different part of the code.
Here's an updated minimal example that reproduces the issue on my machine:
#include <SFML/Graphics.hpp>
void createSomeTextures()
{
for (unsigned i = 0; i < 100; i++)
{
sf::RenderTexture texture;
texture.create(100, 100);
sf::RectangleShape shape({ 50, 50 });
texture.draw(shape);
printf("Thread: %d\n", i);
}
}
int main(int argc, char** argv)
{
sf::Thread thread(&createSomeTextures);
thread.launch();
for (unsigned i = 0; i < 100; i++)
{
sf::RenderTexture texture;
texture.create(100, 100);
sf::RectangleShape shape({ 50, 50 });
texture.draw(shape);
printf("Main: %d\n", i);
}
thread.wait();
return 0;
}
And the locked callstack:
> sfml-system-d-2.dll!sf::priv::MutexImpl::lock() Line 52 C++
sfml-system-d-2.dll!sf::Mutex::lock() Line 57 C++
sfml-system-d-2.dll!sf::Lock::Lock(sf::Mutex & mutex) Line 39 C++
sfml-window-d-2.dll!sf::priv::GlContext::setActive(bool active) Line 423 C++
sfml-window-d-2.dll!sf::Context::setActive(bool active) Line 60 C++
sfml-window-d-2.dll!sf::Context::~Context() Line 53 C++
[External Code]
sfml-graphics-d-2.dll!sf::priv::RenderTextureImplFBO::~RenderTextureImplFBO() Line 68 C++
[External Code]
sfml-graphics-d-2.dll!sf::RenderTexture::~RenderTexture() Line 47 C++
stand.exe!createSomeTextures() Line 11 C++