[fpc-devel] lazarus project crash on paticular event handler call if Objects unit is used

Michael Van Canneyt michael at freepascal.org
Mon Sep 28 09:42:54 CEST 2009



On Sat, 26 Sep 2009, Jonas Maebe wrote:

>
> On 26 Sep 2009, at 16:25, Paul Ishenin wrote:
>
>> Can someone explain how it is possible: 
>> http://bugs.freepascal.org/view.php?id=14670 ?
>> 
>> Objects.pp has only one trivial line of code which executes on the start. 
>> Maybe because it uses "begin end." instead of "initialiaztion"? I guess 
>> that in any case it is a compiler bug rather than a lazarus bug.
>
> The problem is most likely that the "objects" unit declares a TObject type, 
> which is a TP-style object. As a result, the TForm1 methods do not expect a 
> Delphi-style TObject parameter, but a TP-style TObject parameter (by value). 
> I don't know how the ListView1EndDrag and MenuItem1Click methods in unit1 are 
> called, but I assume that's done somehow indirectly with an objpas.TObject 
> parameter, which would result in an unbalanced stack.

This is the explanation. If there is a bug, it is that the streaming does
not check the type of the arguments, just the name of the method.

Delphi has the same 'problem', in fact I make regular use of it :-)

Michael.



More information about the fpc-devel mailing list