🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.oodesign
2 messages
2 total messages Started by bart Thu, 18 Aug 2005 17:40
class instantiation falling over
#68
Author: bart
Date: Thu, 18 Aug 2005 17:40
38 lines
2748 bytes
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..
Re: class instantiation falling over
#69
Author: bart
Date: Thu, 18 Aug 2005 21:05
6 lines
1465 bytes
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..
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads