Fix a crash when copying flex insets to another document.

I know that Inset has a buffer, but we should be careful when handling Insets in CutAndPaste, these don't always have a buffer. Besides, we are in the function switchBetweenClasses(oldone, newone). Then it's pretty strange to ask the flex inset whether it is defined in its buffer->textclass, while we have an explicit new textclass defined.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31223 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-08-24 23:02:50 +00:00
parent eef60e5197
commit a6ff55e539

View File

@ -608,7 +608,10 @@ void switchBetweenClasses(DocumentClass const * const oldone,
if (it->lyxCode() != FLEX_CODE)
// FIXME: Should we verify all InsetCollapsable?
continue;
if (!it->undefined())
docstring const & n = newone->insetLayout(it->name()).name();
bool const is_undefined = n.empty() ||
n == DocumentClass::plainInsetLayout().name();
if (!is_undefined)
continue;
// The flex inset is undefined in newtc
docstring const s = bformat(_(