[vtkusers] Trouble using vtkAxis->SetTitle

Frese Daniel Dr. frese at heidenhain.de
Tue May 3 09:15:35 EDT 2011


Hi !

I am having some strange problem using vtkAxis->SetTitle() from the new charts API.
After the second of the following lines an exception occurs:

                temp = XAxisName->c_str();
                Xaxis->SetTitle(temp);  // title of axis

Temp is of type vtkStdString and Xaxis of type vtkSmartPointer<vtkAxis> (although the behavior is essentially the same when I make Xaxis as a direct vtkAxis without any smart pointers).
I checked that the value of temp at this point is well defined ("TestX"), and I can trace further until I arrive at
void vtkAxis::SetTitle(const vtkStdString &title)
{
  if (this->Title != title)
    {
    this->Title = title;
    this->Modified();
    }
}

, which is defined in vtkAxis.cxx. The exception occurs when trying to execute the line this->Title = title;
The odd thing - already indicating that something goes wrong - is that "title" seems to point four bytes before the right string and seems to be much longer; i.e. it shows XXXXTestXXXXXX..., where X is some arbitrary garbage byte.

I am using Visual Studio 2008 on Win XP and get an exception message stating some memory corruption.

Does anybody has a clue what's going on here ? If I remove calls to SetTitle (I have two of them in my app), everything seems to run smoothly (apart from the missing labels of course).

Daniel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110503/50917dcd/attachment.htm>
-------------- next part --------------
</PRE><p>
------------------------------------------------------------------------------------------------------ <br>
Registergericht: Traunstein / Registry Court: HRB 275 - Sitz / Head Office: Traunreut <br>
Aufsichtsratsvorsitzender / Chairman of Supervisory Board: Rainer Burkhard <br>
Gesch?ftsf?hrung / Management Board: Thomas Sesselmann (Vorsitzender / Chairman),<br>
Michael Grimm, Matthias Fauser, Sebastian Tondorf<br><br>
<a href="http://www.heidenhain.de/disclaimer" target="_blank">E-Mail Haftungsausschluss / E-Mail Disclaimer</a><br><pre>


More information about the vtkusers mailing list