Hi! I've created a plot class, where one can make an object that plots some data. I want this plot to appear in its own window, and be totally free of the main application. This way, one can update the plot without having to create another window. So I made the plot class inherit from sf::thread, and in the run() function I put a regular window loop. I have the following problems:
1. If I close the plot window before the window in the main application, I get an access violation error. This happens in the destructor of sf::thread. (When wait() runs WaitForSingleObject).
2. If I close the main window before the plot window, and then let the main thread sleep for a while, the plot window will just freeze.
3. If I don't open any windows in the main thread, but just let it sleep, the plot window just becomes black.
I'm wondering if I'm going about this problem the right way, and if so, what can be the cause of my problems? Everything works just fine without the threading stuff, so I'm pretty sure it has something to with that.