[lazarus] narrowing down the Dispatch problem
michael at tfdec1.fys.kuleuven.ac.be
michael at tfdec1.fys.kuleuven.ac.be
Sun Jul 11 09:36:34 EDT 1999
On Sat, 10 Jul 1999, Michael A. Hess wrote:
> Peter,
>
> I have narrowed it down to the following line. In Dispatch the line that
> is determining the number of messages in the table is causing the error.
> Let's put it this way that line is were it blows up in xxgdb. :-)
>
> count:=pdword((pdword(...........
>
> This is where it stops in the debugger.
If you got this far, you should have noticed that the vmt was already the
vmt of TObject - which has no messages, and hence is a special case.
I added a check to see if there are messages for that class - now the
follwing runs fine:
program testdisp;
{$mode objfpc}
type TMyObject = Class(TObject)
Procedure Message1(Var Msg); message 1;
Procedure Message2(Var Msg); message 2;
// Procedure Message3(Var Msg); message 3;
end;
Procedure TMYObject.Message1(Var Msg);
begin
Writeln ('Got message : ',DWord(Msg));
end;
Procedure TMyObject.Message2(Var Msg);
begin
Writeln ('Got message : ',DWord(Msg));
end;
{
Procedure TMyObJect.Message3(Var Msg); message 3;
begin
Writeln ('Got message : ',DWord(Msg));
end;
}
Var MyObject : TMyObject;
Msg : Longint;
begin
MyObject:=TMyObject.Create;
// Run until 3, so a non-registered message is sent.
For Msg:=1 to 3 do
MyObject.Dispatch(Msg);
end.
I've committed this in the RTL.
>
> Could this be related to the same reason that we can't add more than 2
> messages to a class definition?
No, because that is a compiler problem, not an RTL problem. So that still
needs to be solved.
Michael.
More information about the Lazarus
mailing list