Opened 2 years ago

Closed 2 years ago

#17942 closed defect (fixed)

Fix for an assertion on wxGTK if trying to destroy a top level window that has not yet been created.

Reported by: botg Owned by:
Priority: normal Milestone:
Component: wxGTK Version: dev-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

wxTopLevelWindowBase::Destroy calls Hide on itself if there is at least one other top level window.

Unfortunately calling Hide on a window that has not yet been created causes an assertion on wxGTK.

It is very easy to reproduce with this snippet you could for example add to the minimal sample in MyFrame::OnAbout:
(new wxDialog)->Destroy();

Both WX_3_0_BRANCH and master are affected by this issue.

I have attached a patch for this issue. With it, Hide is only called if the window is actually shown.

The attached patch has been created against WX_3_0_BRANCH but also applies cleanly against master.

Attachments (1)

fix_assertion_using_hide_in_destroy.diff download (1.8 KB) - added by botg 2 years ago.

Download all attachments as: .zip

Change History (4)

Changed 2 years ago by botg

comment:1 Changed 2 years ago by Paul Cornett <paulcor@…>

In 4a71ba820/git-wxWidgets:

Avoid delayed destruction if TLW was never created. See #17942

comment:2 Changed 2 years ago by Paul Cornett <paulcor@…>

In ce1dce113/git-wxWidgets:

Avoid delayed destruction if TLW was never created. See #17942

(cherry picked from commit 4a71ba820f085a3d5a7233e9fd0e23ae4e45af58)

comment:3 Changed 2 years ago by pcor

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.