Menu

#1110 wxSmith assert when using wxStdDialogButtonSizer in XRC

Undefined
fixed
Bug_Report
2021-10-06
2021-06-30
No

I am using CB on Windows SVN 12468, which uses wxwidget 3.1.5. I have not tried on Linux Mont 20.1, which uses 3.0.5

I get an wxCHECK_RET failure in the wxWidget src\common\wincmn.cpp file on line 2490 when loading the auto_detect_compiler.xrc in wxSmith. Continue works. The wxWidget function that the assert is in is:

void wxWindowBase::SetContainingSizer(wxSizer* sizer)
{
    // Adding a window to another sizer if it's already managed by one would
    // result in crashes later because one of the two sizers won't be notified
    // about the window destruction and so will use a dangling pointer when it
    // is destroyed itself. As such problems are hard to debug, don't allow
    // them to happen in the first place.
    if ( sizer )
    {
        // This would be caught by the check below too, but give a more clear
        // error message in this case.
        wxASSERT_MSG( m_containingSizer != sizer,
                      wxS("Adding a window to the same sizer twice?") );

        wxCHECK_RET( !m_containingSizer,
                     wxS("Adding a window already in a sizer, detach it first!") );
    }

    m_containingSizer = sizer;
}

The wxWidget SetContainingSizer() function code was last changed 6 years ago.
The auto_detect_compiler.xrc file was also last changed 6 years ago.
All of the XRC files that include the wxStdDialogButtonSizer object also have the same issue.

I have tracked the symptom down to the use of <object class="wxStdDialogButtonSizer">, which if I replace it it with <object class="wxBoxSizer"> and make other appropriate changes to for the sizer change. The wxStdDialogButtonSizer is used where dialogs have a "Cancel" or "Ok" or both at the bottom of the dialog.

This has been discussed in the following forum thread:
https://forums.codeblocks.org/index.php/topic,24553.0.html

</object></object>

Discussion

  • Teodor Petrov

    Teodor Petrov - 2021-06-30
    • labels: --> wxSmith, Crash
    • summary: wxWidget alert and memory leak with wxStdDialogButtonSizer --> wxSmith assert when using wxStdDialogButtonSizer in XRC
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     I am using CB on Windows SVN 12468, which uses wxwidget 3.1.5. I have not tried on Linux Mont 20.1, which uses 3.0.5
    
     I get an wxCHECK_RET failure in the wxWidget src\common\wincmn.cpp file on line 2490 when loading the auto_detect_compiler.xrc in wxSmith. Continue works. The wxWidget function that the assert is in is:
    @@ -34,7 +33,5 @@
    
     This has been discussed in the following  forum thread:
         https://forums.codeblocks.org/index.php/topic,24553.0.html
    -    
    -  In the thread oBFusCATed posted:
    -    &#34;It is an issue, please log it. I get a use-after-free report from asan as advertised.&#34;
    +
    
     
  • Miguel Gimenez

    Miguel Gimenez - 2021-09-14

    I didn't notice this ticket until posting ticket 1135, please close it as duplicate.

    The fix is easy, just don't add the window to a sizer. Probably all the code related to Outsizer can be removed, everything works without it.

     
  • Andrew Cottrell

    Andrew Cottrell - 2021-09-15

    I have tested the patch and it resolves the issue I reported.

     
  • bluehazzard

    bluehazzard - 2021-10-06
    • status: open --> fixed
    • assigned_to: bluehazzard
     
  • bluehazzard

    bluehazzard - 2021-10-06

    fixed in r12535

    thank you for reporting Andrew Cottrell
    and thank you for the patch Miguel!

     

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.