[pdp-discuss] TypeAccess question?

Randall C. O'Reilly Randy.OReilly at colorado.edu
Tue Nov 14 20:54:23 MST 2006


I bet the SIMPLE_COPY doesn't handle the memberdef* case correctly -- try 
getting rid of that to see if that is the source of the problem.  if so, 
replace with:

void Copy_(const TestLayer& cp) { var_md = cp.var_md; }

- Randy

On Tuesday 14 November 2006 18:58, Richard Jones wrote:
> I've been having a recurring problem with my code.  Every now and then
> I am getting core dumps while in executing in:
>
> String TypeDef::GetValStr(...)
>
> This will usually be when I want to open an edit dialog on a newly
> created object, such as a layer.  It also happens if I try to save my
> project after newly creating an object.  This latter is a disaster
> since it writes out a corrupt proj.gz file and work is lost.   It
> doesn't happen under all circumstances, but I've got it boiled down to
> reproducibility.  Consider the following class:
>
>   class TestLayer : public Layer {
>
>   public:
>
>        MemberDef*	var_md;
>
> 	  void	UpdateAfterEdit() {};
> 	  void	Initialize() { var_md = NULL;};
> 	  void 	Destroy()		{ };
> 	  void	InitLinks() {};
> 	  SIMPLE_COPY(TestLayer);
> 	  COPY_FUNS(TestLayer, Layer);
> 	  TA_BASEFUNS(TestLayer);
>   };
>
> If in NetViewer I create just one TestLayer and then try to edit it I
> have no problem.  If I create two and try to edit the first, again no
> problem.  But if I try to edit the second I get the dump.  Creating
> one at a time doesn't seem to be a problem, most of the the time.
>
> The problem is related to my inclusion of pointers to taBase classes.
> For instance, if I remove the "MemberDef* var_md" above the problem
> goes away.   There must be something I'm supposed to do but am
> missing.  Any advice I could get would be greatly welcome.
>
> Many thanks.


More information about the PDP-Discuss mailing list