mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
fix memory leak
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2317 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
31a83403af
commit
bf9c99bb37
@ -73,7 +73,6 @@ int MathArray::item_size(int pos) const
|
||||
{
|
||||
return 2 + (isInset(pos) ? sizeof(MathInset*) : 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MathArray::substitute(MathMacro const & m)
|
||||
@ -114,11 +113,13 @@ MathInset * MathArray::prevInset(int pos) const
|
||||
return nextInset(pos);
|
||||
}
|
||||
|
||||
|
||||
unsigned char MathArray::GetChar(int pos) const
|
||||
{
|
||||
return pos < size() ? bf_[pos + 1] : '\0';
|
||||
}
|
||||
|
||||
|
||||
string MathArray::GetString(int & pos) const
|
||||
{
|
||||
string s;
|
||||
@ -134,11 +135,13 @@ string MathArray::GetString(int & pos) const
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
MathTextCodes MathArray::GetCode(int pos) const
|
||||
{
|
||||
return pos < size() ? MathTextCodes(bf_[pos]) : LM_TC_MIN;
|
||||
}
|
||||
|
||||
|
||||
void MathArray::setCode(int pos, MathTextCodes t)
|
||||
{
|
||||
if (pos > size() || isInset(pos))
|
||||
@ -147,6 +150,7 @@ void MathArray::setCode(int pos, MathTextCodes t)
|
||||
bf_[pos + 2] = t;
|
||||
}
|
||||
|
||||
|
||||
void MathArray::insert(int pos, MathInset * p)
|
||||
{
|
||||
bf_.insert(bf_.begin() + pos, 2 + sizeof(p), LM_TC_INSET);
|
||||
@ -159,6 +163,7 @@ void MathArray::replace(int pos, MathInset * p)
|
||||
memcpy(&bf_[pos + 1], &p, sizeof(p));
|
||||
}
|
||||
|
||||
|
||||
void MathArray::insert(int pos, unsigned char b, MathTextCodes t)
|
||||
{
|
||||
bf_.insert(bf_.begin() + pos, 3, t);
|
||||
@ -180,20 +185,24 @@ void MathArray::push_back(MathInset * p)
|
||||
insert(size(), p);
|
||||
}
|
||||
|
||||
|
||||
void MathArray::push_back(unsigned char b, MathTextCodes c)
|
||||
{
|
||||
insert(size(), b, c);
|
||||
}
|
||||
|
||||
|
||||
void MathArray::push_back(MathArray const & array)
|
||||
{
|
||||
insert(size(), array);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MathArray::clear()
|
||||
{
|
||||
for (int pos = 0; pos < size(); next(pos))
|
||||
if (isInset(pos))
|
||||
delete nextInset(pos);
|
||||
bf_.clear();
|
||||
}
|
||||
|
||||
@ -264,7 +273,6 @@ void MathArray::dump2(ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MathArray::dump(ostream & os) const
|
||||
{
|
||||
for (int pos = 0; pos < size(); next(pos)) {
|
||||
|
Loading…
Reference in New Issue
Block a user