Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

class instantiation falling over

0 views
Skip to first unread message

bart

unread,
Aug 18, 2005, 1:40:35 PM8/18/05
to

I just made some changes to a rather large project under developement. The changes involve fundamental shifts to the internals of several classes to make them smarter in handling their data.
My project compiles clean but falls over immediately on the instantiation of some objects, built in the constructor of some main objects. All this worked before the changes BTW.
Here is a dump of the call stack:

7C81EB33 C:\WINDOWS\system32\kernel32.dll
004A93CB System::NotifyNonDelphiException()
7C90378B ntdll.dll
7C90EAFA ntdll.dll
00497C15 Classes::TComponent::Insert(Self=:009E646C, AComponent=:00A84FB4)
00497CA7 Classes::TComponent::InsertComponent(Self=:009E646C, AComponent=:00A84FB4)
004979F4 Classes::TComponent::Create(Self=:00A84FB4, AOwner=:009E646C, ...)
0040EFE0 TAux::TAux(this=:00A84FB4, Owner=:009E646C)
004088B5 TQSPlus::TQSPlus(this=:009E646C, Owner=:009E25CC, globals=:009E2B50)
00412FC1 TForm1::TForm1(this=:009E25CC, Owner=:009E1D68)
004651F7 Forms::TApplication::CreateForm(Self=:009E1D68, InstanceClass=:004C99D0, Reference=:004D38E4)
0040136B WinMain( =:00400000, =NULL, =:00141F1D, =9)
004B4573 __startup

The access exception happens on the Grow call with a read of address 00000000; In this "classes" library code:


function TList.Add(Item: Pointer): Integer;
begin
Result := FCount;
if Result = FCapacity then
Grow;
FList^[Result] := Item;
Inc(FCount);
if Item <> nil then
Notify(Item, lnAdded);
end;

The other wierd thing that I notice is the Class Hierarchy explorer view is confused. Objects appear and disappear and the hierarchy is not complete at times. It appears that it reparses when files are saved, which is when things come and go..

Has anyone seen this behavior before, or have an idea of what to look for to fix it.??

Thanx..

bart

unread,
Aug 18, 2005, 5:05:25 PM8/18/05
to

To answer my own question:

Since this problem seemed to be localized, I thought (grasping at straws) that perhaps some instrumentation might help, so I turned on CodeGuard. This indicated that some memory overwrites were occuring. I fixed a series of these issues and the instantiation was successful.
From this I surmise that the memory overwrites, which were not severe enough to cause an exception, were disturbing either the this pointer or other object attributes and in turn causing the instantiation failures.
Hope this helps others..

0 new messages