Skip to content

X11 - Linux - Fix for orphan window when destroying and recreating game class #423

@blakeb211

Description

@blakeb211

Inside of olc::Platform_Linux, destroying a PGE class and then constructing a new one leaves an orphan window.

This patch fixed it for me, but this might be causing a segfault at full program termination. This is not an issue for me right now, but might be worth a look 🤷‍♂️

virtual olc::rcode ApplicationCleanUp() override
{
      XDestroyWindow(olc_Display, olc_Window);
      /* Patch start - Sync and flush X11 window manager */
      XSync(olc_Display, False); 
      X11::XEvent ev;
      while (XPending(olc_Display)) {
        XNextEvent(olc_Display, &ev);
      }
      /* Patch end */
      return olc::rcode::OK;
}

olcPGE v2.30
PopOS (Ubuntu variant) 24.04LTS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions