Okay, I know this reply is a little late, but it did not. I have managed to narrow down the issue a bit though.
This code gives the threading error (during run-time) described on the previous page.
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#define WIDTH 800
#define HEIGHT 600
void display(void *UserData)
{
sf::RenderWindow* App = static_cast<sf::RenderWindow*>(UserData);
sf::Image screen(WIDTH, HEIGHT);
sf::Sprite sprite;
while (1)
{
App->Clear();
App->Draw(sprite);
}
}
int main()
{
sf::RenderWindow App(sf::VideoMode(WIDTH, HEIGHT, 32), "ElectroToy");
sf::Thread graphics(&display, &App);
graphics.Launch();
App.SetActive();
while (1)
App.Display();
}
However, if you remove all statements that do anything to App other than App.SetActive(false), it works.
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#define WIDTH 800
#define HEIGHT 600
void display(void *UserData)
{
sf::RenderWindow* App = static_cast<sf::RenderWindow*>(UserData);
sf::Image screen(WIDTH, HEIGHT);
sf::Sprite sprite;
while (1)
{
App->Clear();
App->Draw(sprite);
App->Display();
}
}
int main()
{
sf::RenderWindow App(sf::VideoMode(WIDTH, HEIGHT, 32), "ElectroToy");
sf::Thread graphics(&display, &App);
graphics.Launch();
App.SetActive();
graphics.Wait();
}
Now, my main application I'm working on (which is just the above further on in development) will also simply supply this error if calls to App happen in the main function as well as another one.Though at the moment, I have got rid of all App calls from the main function into another function in the same thread. This seems to execute a random number of times (usually, somewhere around 40 times) before showing the threading error. (The threading error only shows in Debug configuration) I am still trying to narrow down the cause of this and the current code is a little too long to post on the forums but if you want to see it, I'll post it. (It's just a bit of a mess).
Thanks for any help