0
votes

I've faced a really odd behavior of Delphi VCL Styles. With VCL styles enabled, and when madExcept has the "instantly crash on buffer overrun" option activated, the menus become non-styled.

Turning this option off, or switching it to "instantly crash on buffer UNDERrun" fixes the menus issue.

Questions are: did anyone else encounter this issue? Why it happens and how to fix it?

2

2 Answers

4
votes

This issue is caused by a internal call to the GetClassName WinAPI function. I just tested and uploaded a fix for that. So you can download the last version of the VCL Styles Utils project from the repository, then add the units Vcl.Styles.Utils.Menus, Vcl.Styles.Utils.SysControls and Vcl.Styles.Utils.SysStyleHook to your project and finally comment or remove the Line (27) {$UNDEF UseVCLStyleUtilsMenu} in the Vcl.Styles.Utils.Menus unit.

0
votes

That seems to indicate to me that the VCL styles code has a buffer overrun. The madExcept memory manager is succeeding in making that buffer overrun manifest as an exception. In turn the styles code responds by disabling styles.

The next course of action is to run the code under the debugger, with debug DCUs enabled so that you can debug the VCL code. Hopefully the debugger will catch the exception and then highlight the buffer overrun.

If you succeed in identifying the problem you can make a workaround and submit a bug report to QC.