Hi,
I am switching from SDL2 to SFML2 and I've found a possible bug, but I am new to SFML, so I am not sure.
I've tried to google and read many topics so I think this is only a ATI driver problem.
My specification of Lenovo G585 notebook is
AMD APU E1-1200 with Radeon HD 7310
Lubuntu 13.10
Proprietary drivers (due to OpenCL support).
I am using SFML2.1 . Tried both, downloading libraries from
http://www.sfml-dev.org/download/sfml/2.1/ and compiling from source with latest commit 4cddde79fe606e22a4327a8ec26ad62fc4a9b7f7 . Same result.
Program compile just fine, but when destroying RenderWindow object, program crash with 234 return code. Tried to allocate and destruct using new and delete (shown in the code) and creating RenderWindow as local variable as shown in tutorials, no change. In this example, stdout writes only "One" and "Two", than it crashes.
Compiled on Intel platform with Kubuntu 13.10 and program quits normally with exit code 0.
Do not know whether this problem is only multithreading-specific, in simple monothread application never crashed. I also tried to activate and deactivate window in threads, same result.
Can be this fixed? If no, is there any workaround like managing OpenGL context manually or inheriting RenderWindow and reimplementing deallocating and freeing resources?
#include <iostream>
#include <SFML/Graphics.hpp>
#include <thread>
using namespace sf;
using namespace std;
RenderWindow * gw;
void draw() {
gw->clear(Color(0, 0, 0, 128));
CircleShape c;
c.setPosition(300, 200);
c.setRadius(100);
c.setFillColor(Color::Red);
gw->draw(c);
gw->display();
gw->setActive(false);
}
int main(int argc, char** argv) {
gw = new RenderWindow(VideoMode(800, 600), "My window");
gw->setActive(false);
thread t(&draw);
t.join();
cout << "One" << endl;
gw->close();
cout << "Two" << endl;
delete gw; //crashes here
cout << "Three" << endl;
return 0;
}
Thank you for your help and time.