Menu

#845 wxsmith does not destroy the common dialogs it creates

Undefined
applied
wxsmith (1)
Bug_Report
2021-05-08
2019-06-18
No

wxSmith creates common dialogs in the heap but does not destroy them, leading to memory leaks and hangs on exit. In fact, wxsmith creates this code in the frame's destructor:

  //(*Destroy(TestFrame)
  //*)

but never writes inside it.

Discussion initiated in the forum. Some say common dialogs should not be in wxSmith, but if they are they should be destroyed properly.

http://forums.codeblocks.org/index.php/topic,23324.0.html

Discussion

  • Miguel Gimenez

    Miguel Gimenez - 2019-06-19

    This patch fixes the issue. wxPageSetupDialog and wxPrintDialog are deleted, the rest are destroyed.

    EDIT: patch deleted on 2021/05/06

     

    Last edit: Miguel Gimenez 2021-05-06
  • Miguel Gimenez

    Miguel Gimenez - 2019-06-19

    While testing I discovered that the code generated for wxRichtextStyleOrganiserDialog does not compile because it needs wx/dialog.h to be included before wx/richtext/richtextstyledlg.h. I think this is a wxWidgets issue, but while they fix it we need a workaround,

    This second patch fixes this, and must be applied after the one above.

    EDIT: ticket created in wxWidgets site.
    EDIT2: fixed in wx3.0 and wx3.1 branches, but this patch is needed anyway
    EDIT3: patch deleted on 2021/05/06

     

    Last edit: Miguel Gimenez 2021-05-06
  • Miguel Gimenez

    Miguel Gimenez - 2021-05-06

    I have updated the patch and divided it in two parts.

    The first part (wxsmith3a.patch) adds the infrastructure needed for inserting code automatically in window destructors, namely variable m_DestroyingCode holding the code to be inserted and AddDestroyingCode() method for appending code to it.

    The second part (wxsmith3b.patch) adds destroying code for the following common dialogs:
    ColourDialog
    DirDialog
    FileDialog
    FindReplaceDialog
    FontDialog
    MessageDialog
    MultiChoiceDialog
    PageSetupdialog
    PasswordEntryDialog
    PrintDialog
    RichtextFormattingDialog
    RichtextStyleOrganiserDialog
    SingleChoiceDialog
    SymbolPickerDialog
    * TextEntryDialog

    As said in the original post, the added code prevents application locking when deleting the object that owns some of the dialogs listed above. Other dialogs do not lock the application, but may have other secondary effects.

     

    Last edit: Miguel Gimenez 2021-05-06
  • Teodor Petrov

    Teodor Petrov - 2021-05-08
    • status: open --> applied
    • assigned_to: Teodor Petrov
     
  • Teodor Petrov

    Teodor Petrov - 2021-05-08

    Applied, but I've decided to combine the patches. Thanks.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.