Fix the assertion assert introduced in r34348 which got fired when eg. deselecting an InsetCommand:

- we have to have a copy constructor in InsetCommand to clear the mouse_hover_ map and not to copy it,
- there is no need to have mouse_hover_() in the initialisation list,
- there is no need to copy the auto_open_ map.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34353 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-05-01 23:04:08 +00:00
parent 60466235fe
commit 9c8e7429fa
3 changed files with 15 additions and 8 deletions

View File

@ -50,17 +50,15 @@ InsetCollapsable::InsetCollapsable(Buffer * buf, InsetText::UsePlain ltype)
} }
// The sole purpose of this copy constructor is to make sure
// that the mouse_hover_ map is not copied and remains empty.
InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs) InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs)
: InsetText(rhs), : InsetText(rhs),
status_(rhs.status_), status_(rhs.status_),
labelstring_(rhs.labelstring_), labelstring_(rhs.labelstring_),
button_dim(rhs.button_dim), button_dim(rhs.button_dim),
openinlined_(rhs.openinlined_), openinlined_(rhs.openinlined_)
auto_open_(rhs.auto_open_), {}
// the sole purpose of this copy constructor
mouse_hover_()
{
}
InsetCollapsable::~InsetCollapsable() InsetCollapsable::~InsetCollapsable()
@ -182,7 +180,7 @@ Dimension InsetCollapsable::dimensionCollapsed(BufferView const & bv) const
void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
auto_open_[mi.base.bv] = mi.base.bv->cursor().isInside(this); auto_open_[mi.base.bv] = mi.base.bv->cursor().isInside(this);
FontInfo tmpfont = mi.base.font; FontInfo tmpfont = mi.base.font;
mi.base.font = getLayout().font(); mi.base.font = getLayout().font();
@ -250,7 +248,7 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
{ {
BufferView const & bv = *pi.base.bv; BufferView const & bv = *pi.base.bv;
auto_open_[&bv] = bv.cursor().isInside(this); auto_open_[&bv] = bv.cursor().isInside(this);
FontInfo tmpfont = pi.base.font; FontInfo tmpfont = pi.base.font;
pi.base.font = getLayout().font(); pi.base.font = getLayout().font();

View File

@ -59,6 +59,13 @@ InsetCommand::InsetCommand(Buffer * buf, InsetCommandParams const & p,
{} {}
// The sole purpose of this copy constructor is to make sure
// that the mouse_hover_ map is not copied and remains empty.
InsetCommand::InsetCommand(InsetCommand const & rhs)
: Inset(rhs), p_(rhs.p_), mailer_name_(rhs.mailer_name_)
{}
InsetCommand::~InsetCommand() InsetCommand::~InsetCommand()
{ {
if (!mailer_name_.empty()) if (!mailer_name_.empty())

View File

@ -38,6 +38,8 @@ public:
InsetCommand(Buffer *, InsetCommandParams const &, InsetCommand(Buffer *, InsetCommandParams const &,
std::string const & mailer_name); std::string const & mailer_name);
/// ///
InsetCommand(InsetCommand const & rhs);
///
~InsetCommand(); ~InsetCommand();
/// returns true if params are successfully read /// returns true if params are successfully read