Board index » cppbuilder » Published/Unpublished Access Violations

Published/Unpublished Access Violations


2005-09-16 03:05:30 AM
cppbuilder60
using cbuilder6, i've been having some mysterious access violations that
i have finally managed to condense into some short code snippets. it's
easier to show the code than describe, i think. i've made two packages:
Test1 and Test2.
the package Test1 contains just one component, as follows:
//---------------------------------------------------------------------------
class PACKAGE TEmptyComponent : public TComponent
{
private:
protected:
public:
__fastcall TEmptyComponent(TComponent* Owner);
__published:
};
//---------------------------------------------------------------------------
notice that it contains no new data or functions. to help simplify an
example, i made it just a wrapper.
the Test2 package contains just one component:
//------------ header --------------------------------------------------
class PACKAGE TTestTable : public TTable
{
private:
protected:
TEmptyComponent* FEmptyComponent;
public:
__fastcall TTestTable(TComponent* Owner);
__published:
__property TEmptyComponent* EmptyComponent = {read=FEmptyComponent,
write=FEmptyComponent};
};
//----------- .cpp -----------------------------------------------------
__fastcall TTestTable::TTestTable(TComponent* Owner)
: TTable(Owner)
{
FEmptyComponent = new TEmptyComponent(this);
}
//---------------------------------------------------------------------------
the only thing i've added to the TTable is a TEmptyComponent property.
if i think drop this component from the component pallet onto a form
(which can be part of Test2, but i've seen the problem in other
packages/projects), i get an access violation. if i move the
EmptyComponent property to the unpublished public section, i do not get
an access violation when dropping it on a form.
since the violation goes away when i don't publish that property, i
suspect that the blowup has something to do with the object inspector,
but i don't really know that for a fact. i just suspect it. i've noticed
other peculiarites in the object inspector. for instance, data
properties may show up on the events tab, but in red instead of black.
this worked just fine in cbuilder3. i have multiple components in where
i did this sort of thing without problem. in cbuilder6, the violation
happens sometimes when i use derived components as properties, but not
others. i can't find a pattern, so i just made the simplest example i
could and am posting it.
anyone got any clues here?
 
 

Re:Published/Unpublished Access Violations

Hi,
Quote
i did this sort of thing without problem. in cbuilder6, the violation
happens sometimes when i use derived components as properties, but not
That sounds slightly familiar, like something fixed in a patch. Are all
the patches applied?
--Craig