[vtkusers] The value of ESP was not properly saved????
Andrew J. Dolgert
ajd27 at cornell.edu
Mon Feb 27 14:31:01 EST 2006
I don't see anything glaring in the code, but I know this is
frustrating, so I'll offer what suggestions I have. ESP is the stack
pointer, so the message indicates stack corruption. That could happen a
number of ways.
1. Disagreement in the calling conventions, as suggested by the error
message.
2. I think I've seen the Microsoft version of the STL corrupt the stack.
You could try storing the vector of Labels as vector<Label>* m_LabelList
instead.
3. The compiler has a set of run-time checks it can perform, all
starting with /RTC. They can sometimes detect stack corruption around a
variable the first time it happens. It is possible that something was
corrupted before this particular function call but that the check found
the problem on the way out of this function. Just make sure you have all
the possible checks turned on and look at the code between the two
invocations of this function.
4. I saw a web page that made two suggestions: VC6 with a version of
Windows XP without SP2 had a bug, so upgrading to SP2 would fix it.
(Doesn't seem like you interact with the OS, so probably not it.) It
also suggested that changed exception handling could change the calling
convention. This would have to be the structured exception handling,
SEH, and there is a choice for it in the C/C++ properties dialog.
5. If you were, by chance, to call AddLabelContour() from more than one
thread, that would be trouble, too.
You have a number of memory leaks. It isn't likely your problem but
would be good to clean up just to rule things out. When you call
m_labelList->push_back(*LatestLabel), that makes a copy of the Label
using an implicit copy constructor. You still have to delete the
original. Alternatively, you could make the container hold pointers to
labels, vector<Label*>, and delete them later. Also, after you've made
the vtkActor, each stage of the pipeline holds a reference to the filter
before it. You can call labelcontour->Delete(), labelnormals->Delete()
and so forth. Then, later, deleting the actor gets rid of the whole
bunch of filters automatically.
Drew
Cornell Theory Center
More information about the vtkusers
mailing list