News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Assert in Setting/Environment

Started by Pecan, March 21, 2026, 06:22:20 PM

Previous topic - Next topic

Pecan

Using wx328, I get an assert when clicking Settings/Environment caused by the Dark/Lite setting.

I don't know how to fix this. (commenting out line 768 in trunk\src\src\resources\env_settings.xrc works ).

Windows 11 svn rev 13826


Hmmm... This is happening only in the debuggee. Why would that be?
Maybe the different personality? Nope, that's not it.

blauzahn

Looks like issued by wx, not cb. If it is actually an assert, no wonder why it pops up in DEBUG only.

For further readers: It is the horizontal sizer which contains the label "select application appearance" and the combo-box where you select between default, dark and lite mode.

It makes sense to me when reading the corresponding wx doc: https://docs.wxwidgets.org/3.2/overview_sizer.html#overview_sizer_box

QuoteCorrespondingly, when using a horizontal sizer, each child can be centered, aligned at the bottom or aligned at the top.

Being no expert on wx whatsoever, I estimate, that just the flag wxALIGN_CENTER_HORIZONTAL should be deleted, not the whole line.
Pulling the window larger the static label remains the same size while the combo box grows. That's fine for me. So, probably no need for a spacer.

The corresponding snippet around trunk/src/src/resources/env_settings.xrc:768 is:


<object class="sizeritem">
<object class="wxBoxSizer">
<object class="sizeritem">
<object class="wxStaticText" name="wxID_ANY">
<label>Select application appearance (if supported by platform):</label>
</object>
<flag>wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
<border>4</border>
</object>
<object class="sizeritem">
<object class="wxChoice" name="chAppearance">
<content>
<item>System default</item>
<item>Dark</item>
<item>Light</item>
</content>
<selection>0</selection>
<enabled>0</enabled>
</object>
<flag>wxALIGN_CENTER_VERTICAL</flag>
<border>4</border>
<option>1</option>
</object>
</object>
<flag>wxEXPAND</flag>
<border>4</border>
</object>


ollydbg

#2
I'm having the same issue here, C::B is link to the wxWidgets 3.3.2 library built with "Debug" option under Windows.

EDIT:

The assert also happens in the release build of C::B link against wx 3.3.2.

The code is related here:
https://github.com/wxWidgets/wxWidgets/blob/d05c5c1d3e55542e63711778193175c099774f60/src/xrc/xh_sizer.cpp#L768
You can see, the line is: xh_sizer.cpp, line 768.
But if you look at the xrc file, the line is also 768.
This is just a coincidence.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

#3
I just did some test, the result is:

It looks like if you just remove the wxALIGN_CENTER_HORIZONTAL in the xrc file from line 768, you will still see this assert when you try to open the setting dialog.

So, do you think this is the position of the wrong xrc setting? I think it is not.  ;)



EDIT:

remove the option wxALIGN_CENTER_HORIZONTAL in the xrc file's line 768 did fix the assert issue.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Miguel Gimenez

I have fixed incorrect usage of these flags in some files (see r13827).

I have NOT changed env_settings.xrc, as the discussion is still alive.

ollydbg

Quote from: Miguel Gimenez on March 23, 2026, 01:31:59 PM
I have fixed incorrect usage of these flags in some files (see r13827).

I have NOT changed env_settings.xrc, as the discussion is still alive.

Hi, Miguel Gimenez, thanks for the fix. I think you can fix the issues in the env_settings.xrc too.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Miguel Gimenez


ollydbg

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.


blauzahn

QuoteFixed in r13828.

Thank you. I hope my post helped a little to shed some light onto the topic.