[Lazarus] Gtk2 division by 0 in themes fix

Ales Katona almindor at gmail.com
Tue Jul 15 23:31:14 CEST 2008


Mattias Gaertner  wrote / napĂ­sal(a):
> No. Damn.
>
> About 'before calling gtk':
> The bug is triggered in a gtk event. There is no pascal code *before*.
>
>   
Indeed you do gtk_main() and the crash happens inside. There's no real 
way of switching these only for the gtk lib apart from rewriting gtk 
bindings AND all callbacks which is pretty much impossible to 
synchronize the on/off of it.
>>  If not, it might be
>> worth to add this the list of 'incompatibilities'.
>>
>> procedure TForm1.Button1Click(Sender: TObject);
>> var x, y, z: single;
>> begin
>>    x := 3.0; y := 1.0;
>>    try
>>      z := (x - y ) / (y - 1.0);
>>    except
>>      ShowMessage('Exception occurred');
>>    end;
>> end;
>>     
>
> Apparently there is a real div by zero error.
>   
Indeed, that's how it seemed. My example project which uses pure gtk2 
got that, however the line in the themeengine.so which gdb showed me did 
not have a /0 argument in it, so I think there's a some sort of "effect 
delay".

Since I managed to bypass GtkAdjustment there's no risk of wrong record 
padding etc. so this is defenetly not some sort of wrong sized arguments 
or somesuch. I think it's basically a bug in gtk/humantheme engine.
> Mattias
>   
Ales



More information about the Lazarus mailing list