Skip to content

Destroying a non-top modal window leaves a dangling pointer #3223

Description

@tintinhamans

Prerequisites

  • I have searched for similar issues and confirmed this is not a duplicate

Game Version

  • Command & Conquer Generals
  • Command & Conquer Generals: Zero Hour

Bug Description

Destroyed windows are only removed from the modal stack when they are on top.

For example, with a stack of B → A, destroying A leaves B → freed A. When B closes, the freed pointer becomes the stack head. The next mouse event calls winPointInChild() on it and crashes.

Destroyed windows should be removed from the entire modal stack.

Reproduction Steps

  1. Open modal window A.
  2. Open modal window B above it.
  3. Destroy A while B remains open.
  4. Close B.
  5. Move the mouse.

Additional Context

This was observed with 0xDEADBEEF passed to GameWindow::winPointInChild(). The affected modal cleanup exists in both the Generals and Zero Hour window managers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething is not working right, typically is user facingCrashThis is a crash, very badGUIFor graphical user interfaceGenRelates to GeneralsMajorSeverity: Minor < Major < Critical < BlockerMemoryIs memory relatedStabilityConcerns stability of the runtimeZHRelates to Zero Hour

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions