Fixed memory leak

This commit is contained in:
Robert 2020-11-10 19:56:47 +01:00
parent 74c34370e2
commit e0635a4218

View file

@ -9,11 +9,17 @@ int main(int argc, char** argv)
Signal sig; Signal sig;
RenderWindow* window; RenderWindow* window;
DummyScreen* ds;
PlotScreen* ps;
try try
{ {
window = new RenderWindow(800, 800); window = new RenderWindow(800, 800);
window->AddScreen(new DummyScreen(window->renderer, 0, 0, 800, 800));
window->AddScreen(new PlotScreen(window->renderer, &sig, 50, 50, 700, 300, 0, -1.5f, 10, 1.5f)); ds = new DummyScreen(window->renderer, 0, 0, 800, 800);
ps = new PlotScreen(window->renderer, &sig, 50, 50, 700, 300, 0, -1.5f, 10, 1.5f);
window->AddScreen(ds);
window->AddScreen(ps);
} }
catch (const std::runtime_error& e) catch (const std::runtime_error& e)
{ {
@ -23,5 +29,12 @@ int main(int argc, char** argv)
window->Run(); window->Run();
window->RemoveScreen(ps);
window->RemoveScreen(ds);
delete ps;
delete ds;
delete window;
return 0; return 0;
} }