Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Run-Time Check Failure #2 - Stack around the variable 'NiPlots' was corrupted.

Why do I get this message box pop up in Visual C++.net with the following code when exiting the function:

void CESCView::InitGraphPower(void)
{
CNiPlots NiPlots;

if (m_NiGraphPower.m_hWnd)
{
m_NiGraphPower.PlotAreaColor = COLOR_LIGHT_YELLOW;

NiPlots = m_NiGraphPower.GetPlots();
NiPlots.RemoveAll();
NiPlots.Add();
NiPlots.Add();
NiPlots.Add();
NiPlots.Item(VIEW_PLOT_POWER_ACTUAL).SetLineColor(COLOR_BLUE);
NiPlots.Item(VIEW_PLOT_POWER_DCH).SetLineColor(COLOR_RED);
NiPlots.Item(VIEW_PLOT_POWER_REG).SetLineColor(COLOR_RED);
}
else
{
ASSERT(FALSE);
}
}



The code below runs without any problem

void CESCView::InitGraphPower(void)
{
//C
NiPlots NiPlots;

if (m_NiGraphPower.m_hWnd)
{
m_NiGraphPower.PlotAreaColor = COLOR_LIGHT_YELLOW;

//NiPlots = m_NiGraphPower.GetPlots();
m_NiGraphPower.GetPlots().RemoveAll();
m_NiGraphPower.GetPlots().Add();
m_NiGraphPower.GetPlots().Add();
m_NiGraphPower.GetPlots().Add();
m_NiGraphPower.GetPlots().Item(VIEW_PLOT_POWER_ACTUAL).SetLineColor(COLOR_BLUE);
m_NiGraphPower.GetPlots().Item(VIEW_PLOT_POWER_DCH).SetLineColor(COLOR_RED);
m_NiGraphPower.GetPlots().Item(VIEW_PLOT_POWER_REG).SetLineColor(COLOR_RED);
}
else
{
ASSERT(FALSE);
}
}
0 Kudos
Message 1 of 3
(3,731 Views)
Hello,
Please make sure you have the Visual C++.NET update. If you do not, you can request the update from:

http://digital.ni.com/softlib.nsf/websearch/54D7F0484F7AE7D786256B900073DB48?opendocument

Mika Fukuchi
Application Engineer
National Instruments
0 Kudos
Message 2 of 3
(3,731 Views)
I am running the update, but still getting this error.
0 Kudos
Message 3 of 3
(3,731 Views)