Hi,
On a scrollbox I put a few panels and splitters. Because updating the scrollbox is very slow, I was looking what happened when i use ScrollBox1.DisableAutoSizing. Then I get a divide by zero error and the LazTracer unit opens. It stops in the procedure RaiseGDBException of the unit unit LazTracer.
This is the function:
procedure RaiseGDBException(const Msg: string);
begin
DebugLn(lrsERRORInCode, Msg);
// creates an exception, that gdb catches:
DebugLn(lrsCreatingGdbCatchableError);
DumpStack;
{$ifndef HASAMIGA} // On Amiga Division by 0 is not catchable, just crash
if (length(Msg) div (length(Msg) div 10000))=0 then ;
{$endif}
end;
the error happens in the line:
if (length(Msg) div (length(Msg) div 10000))=0 then ;
The cause is that Msg is empty.
It should have been something like this:
{$ifndef HASAMIGA} // On Amiga Division by 0 is not catchable, just crash
if Msg = '' then Exit;
if (length(Msg) div (length(Msg) div 10000))=0 then ;
{$endif}
If i look in the callstack window and if I see it correctly then the function is called from
procedure TWinControl.DoAllAutoSize;
from wincontrol.inc. The call for it is:
if cfAutoSizeNeeded in FControlFlags then RaiseGDBException('');
this one calls RaiseGDBException with an empty Msg?
Reproducible with attached project. If you move splitter 2 you will get the divide by zero message. It feels like a bug.
Used: Windows 11, Lazarus 4.6.