-
Notifications
You must be signed in to change notification settings - Fork 465
Open
Description
In EntryPoint.h,
Walnut/Walnut/src/Walnut/EntryPoint.h
Lines 10 to 20 in 3b8e414
| int Main(int argc, char** argv) | |
| { | |
| while (g_ApplicationRunning) | |
| { | |
| Walnut::Application* app = Walnut::CreateApplication(argc, argv); | |
| app->Run(); | |
| delete app; | |
| } | |
| return 0; | |
| } |
This code appears to have a logical error, as it creates and deletes a new Walnut::Application object in each iteration of the while loop. This means that the application is constantly being restarted and terminated, which is probably not the intended behavior. A more reasonable approach would be to create the application object once before the loop, and delete it once after the loop, like this:
namespace Walnut {
int Main(int argc, char** argv)
{
Walnut::Application* app = Walnut::CreateApplication(argc, argv);
while (g_ApplicationRunning)
{
app->Run();
}
delete app;
return 0;
}
}
Please correct me if I'm mistaken here, Or maybe there's a good reason for it, I'm very new to this project.
Metadata
Metadata
Assignees
Labels
No labels