Ensure that the dirdialog is destroyed after use
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25069 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
0a7cad3a87
commit
6046f86450
@ -338,19 +338,17 @@ class DirBrowseButton(FileBrowseButton):
|
|||||||
labelText, buttonText, toolTip,
|
labelText, buttonText, toolTip,
|
||||||
dialogTitle, startDirectory,
|
dialogTitle, startDirectory,
|
||||||
changeCallback = changeCallback)
|
changeCallback = changeCallback)
|
||||||
#
|
self.dialogClass = dialogClass
|
||||||
self._dirDialog = dialogClass(self,
|
|
||||||
message = dialogTitle,
|
|
||||||
defaultPath = startDirectory)
|
|
||||||
#
|
#
|
||||||
|
|
||||||
def OnBrowse(self, ev = None):
|
def OnBrowse(self, ev = None):
|
||||||
dialog = self._dirDialog
|
dialog = self.dialogClass(self,
|
||||||
|
message = self.dialogTitle,
|
||||||
|
defaultPath = self.startDirectory)
|
||||||
if dialog.ShowModal() == wx.ID_OK:
|
if dialog.ShowModal() == wx.ID_OK:
|
||||||
self.SetValue(dialog.GetPath())
|
self.SetValue(dialog.GetPath())
|
||||||
|
dialog.Destroy()
|
||||||
#
|
#
|
||||||
def __del__(self):
|
|
||||||
if self.__dict__.has_key('_dirDialog'):
|
|
||||||
self._dirDialog.Destroy()
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user