Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2009-09

lazarus project crash on paticular event handler call if Objects unit is used

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Paul Ishenin

Hello, FPC developers' list

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.

Best regards,
Paul Ishenin.

Reply by email

Jonas Maebe
to Paul Ishenin
Paul Ishenin wrote 7 lines
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.

Jonas

Reply by email

Paul Ishenin
to Jonas Maebe
Jonas Maebe wrote 7 lines
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.

Thanks. Probably you are right. TForm1.ListView1EndDrag is called from the next method:

procedure TControl.DoEndDrag(Target: TObject; X,Y: Integer);
begin
  if Assigned(FOnEndDrag) then FOnEndDrag(Self,Target,X,Y);
end;

I experimented more. I removed objects from the uses list and added my own TObject = object declaration to the Unit1. It crashes in this case also.

Best regards,
Paul Ishenin.

Reply by email

Michael Van Canneyt
to Jonas Maebe: The problem is most likely that the "objects" unit declares a TObject type, which is a…
Jonas Maebe wrote 16 lines
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.

Reply by email