fix the 0-ref + a memory lieak with strnew

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1026 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-09-18 18:57:22 +00:00
parent 4c295014fe
commit 7bfd36da33
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2000-09-18 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/mathed/math_cursor.C (MacroModeClose): don't call SetName
with strnew in arg, use correct emptystring when calling SetName.
* several files: remove all commented code with relation to
HAVE_SSTREAM beeing false. We now only support stringstream and
not strstream.

View File

@ -777,14 +777,15 @@ void MathedCursor::MacroModeClose()
if (macroln > 0 && (!l || (l && IsMacro(l->token, l->id))) &&
!MathMacroTable::mathMTable.getMacro(macrobf)) {
if (!l) {
imacro->SetName(strnew(macrobf));
//imacro->SetName(strnew(macrobf));
imacro->SetName(macrobf);
// This guarantees that the string will be removed by destructor
imacro->SetType(LM_OT_UNDEF);
} else
imacro->SetName(l->name);
} else {
Left();
imacro->SetName(0);
imacro->SetName("");
if (cursor->GetInset()->GetType() == LM_OT_ACCENT) {
setAccent(static_cast<MathAccentInset*>(cursor->GetInset())->getAccentCode());
}