Opened 18 months ago

Closed 17 months ago

Last modified 17 months ago

#15156 closed defect (fixed)

wxFilePickerCtrl doesn't destroy wxFileDialog

Reported by: jbbbms Owned by:
Priority: normal Milestone:
Component: wxGTK Version: stable-latest
Keywords: wxFilePickerCtrl Cc:
Blocked By: Blocking:
Patch: yes

Description

The resource leak will be reported when the program exits, if it links to debug version of wxGTK.

Attachments (2)

filepicker.diff download (995 bytes) - added by jbbbms 18 months ago.
buggy.cpp download (774 bytes) - added by jbbbms 18 months ago.
how to reproduce it

Download all attachments as: .zip

Change History (7)

comment:1 follow-up: Changed 18 months ago by vadz

  • Status changed from new to infoneeded_new

Sorry, the patch is impossible to read because of "-U0" you used (why?), so I have really no idea what is it doing nor which problem exactly does it fix because you don't tell how to reproduce it. Could you please do this?

Changed 18 months ago by jbbbms

Changed 18 months ago by jbbbms

how to reproduce it

comment:2 in reply to: ↑ 1 Changed 18 months ago by jbbbms

  • Status changed from infoneeded_new to new

Replying to vadz:

Sorry, the patch is impossible to read because of "-U0" you used (why?), so I have really no idea what is it doing nor which problem exactly does it fix because you don't tell how to reproduce it. Could you please do this?

Sorry. Have replaced the old patch and attached an example to reproduce the leak.

comment:3 Changed 17 months ago by vadz

  • Status changed from new to confirmed
  • Version changed from 2.8.12 to 2.9-svn

The patch still doesn't apply to the latest sources but I do see the problem and it seems like the fix for it is to just destroy the dialog in the dtor of the button. I'm going to commit this soon if you don't have any objections.

comment:4 Changed 17 months ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [74030]) Delete the associated dialog in wxGTK wx{File,Dir}Button.

The code seemed to rely on Destroy() being called for deleting the dialog, but
it's actually not used for child windows, so do it in dtor instead.

Closes #15156.

comment:5 Changed 17 months ago by VZ

(In [74042]) Fix GTK+ errors during wxFilePickerCtrl destruction after recent changes.

We do need to destroy the dialog (see #15156), but we must not destroy its
GtkWidget as it is owned by GtkFileChooserButton itself, so amend the changes
of r74030 to only destroy the C++ object, not GTK+ one.

Note: See TracTickets for help on using tickets.