wstring 赋值总是报错
最近用到一个开源控件,http://www.codeproject.com/Articles/14075/High-speed-Charting-Control,之前用的一直是好好的,没什么问题,可现在用到里面的字符串时,总是报错
比如pLeftBottomAxis->GetLabel()->SetText(_T("时间");
CChartFont bottomFont;
bottomFont.SetFont(_T("宋体"), 120, false, true, false); 只要用到里面的TChartString类型,就报错0x000005错误,定位到里面的代码,m_Font = newFont; 其实就是TChartString赋值,为什么总是报错。内存哪里越界了?
void CChartAxisLabel::SetFont(const CChartFont& newFont)
{
m_Font = newFont;
if (m_pParentCtrl)
m_pParentCtrl->RefreshCtrl();
}
bool _Grow(size_type _Newsize,
bool _Trim = false)
{ // ensure buffer is big enough, trim to size if _Trim is true
if (max_size() < _Newsize)
_Xlen(); // result too long
if (this->_Myres < _Newsize)
_Copy(_Newsize, this->_Mysize); // reallocate to grow
else if (_Trim && _Newsize < this->_BUF_SIZE)
_Tidy(true, // copy and deallocate if trimming to small string
_Newsize < this->_Mysize ? _Newsize : this->_Mysize);
else if (_Newsize == 0)
_Eos(0); // new size is zero, just null terminate
return (0 < _Newsize); // return true only if more work to do
}
因为工程已经写了一大半,时间紧,没时间重写Curve