Skip to content

Is the create and delete of the app intentional in EntryPoint.h? #73

@glenpierce

Description

@glenpierce

In EntryPoint.h,

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions