Disallow to insert an inset without a font

Doing so could lead to an assertion in Paragraph::fontSpan.
This commit is contained in:
Vincent van Ravesteijn 2013-05-19 12:39:01 +02:00
parent 8a40336848
commit 30f5187070
2 changed files with 2 additions and 15 deletions

View File

@ -767,7 +767,7 @@ void Paragraph::Private::insertChar(pos_type pos, char_type c,
bool Paragraph::insertInset(pos_type pos, Inset * inset,
Change const & change)
Font const & font, Change const & change)
{
LASSERT(inset, return false);
LASSERT(pos >= 0 && pos <= size(), return false);
@ -785,6 +785,7 @@ bool Paragraph::insertInset(pos_type pos, Inset * inset,
// Some insets require run of spell checker
requestSpellCheck(pos);
setFont(pos, font);
return true;
}
@ -1782,16 +1783,6 @@ void Paragraph::insertChar(pos_type pos, char_type c,
}
bool Paragraph::insertInset(pos_type pos, Inset * inset,
Font const & font, Change const & change)
{
bool const success = insertInset(pos, inset, change);
// Set the font/language of the inset...
setFont(pos, font);
return success;
}
void Paragraph::resetFonts(Font const & font)
{
d->fontlist_.clear();

View File

@ -377,10 +377,6 @@ public:
///
void insertChar(pos_type pos, char_type c,
Font const &, Change const & change);
/// Insert \p inset at position \p pos with \p change traking status.
/// \return true if successful.
bool insertInset(pos_type pos, Inset * inset,
Change const & change);
/// Insert \p inset at position \p pos with \p change traking status and
/// \p font.
/// \return true if successful.