简体   繁体   中英

SWIG/Python detected wxPasswordEntryDialog Memory Leak

I'm using a wx.PasswordEntryDialog to get a password from the user, but every time I create a PasswordEntryDialog I get this error:

swig/python detected a memory leak of type 'wxPasswordEntryDialog *', no destructor found.

Here is one of the places that causes it:

def getpass():
    dialog = wx.PasswordEntryDialog(None, 'Enter your password')
    if dialog.ShowModal() == wx.ID_OK:
        value = dialog.GetValue()
    else:
        value = None
    del dialog
    return value

I found that you can get rid of the message by replacing the line

del dialog

with

dialog.Destroy()

(I'm using wxWidgets/wxPython 2.9.3, if that's relevant.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM