Skip to content

GDK main function may leak resources #14512

@castholm

Description

@castholm

Extracted from #12676, #14502 (comment)

Currently, in the GDK implementation of SDL_RunApp(), if GDK_RegisterChangeNotifications() fails, XTaskQueueTerminate(), XTaskQueueCloseHandle() and XGameRuntimeUninitialize() never get called, and argv is never freed. It also appears that the GDK_RegisterChangeNotifications() implementation itself doesn't appear to always clean up resources correctly on failure. It would be good to fix these.

Additionally, the Microsoft docs for XblInitialize() state that it "should have a corresponding call to XblCleanup()", which is currently missing from the GDK SDL_RunApp() and should probably be added for good measure, since it's unclear what the effects of not calling it are.

There is also a !!! FIXME comment about leaking handles despite following the Microsoft docs exactly. But looking at the Microsoft docs for cleaning up a task queue it looks like the example passes a timeout of INFINITE (0xffffffff), while SDL currently passes 0, so perhaps changing that will fix the leak.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions