On Tue, Jun 23, 2015 at 02:23:18PM +0100, Guillaume M-M wrote:
> Le 23/06/2015 10:46, Enrico Forestieri a écrit :
> >
> >Indeed, this has to do with the general problem of copying macros and
> >how the various structures are carried on when copying.
> 
> OK for the fact that this is not a regression, but why should it be
> different depending on whether preview is on or off?

I don't know, maybe this is a case of a race condition. Most probably,
with preview on, updateMacros() is not called (or is called later) and
the MacroData:sym_ pointer is not updated at the time MacroData::xlmname()
is called so that it contains bogus values. This seems to be confirmed by
the attached patch that explicitly sets to null the MacroData::sym_ pointer
whenever a macro is copied. With this patch the crash is gone for me.

I think that this is to be considered as a different instance of #9418,
as also witnessed by the exact same backtrace.

-- 
Enrico
diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp
index 24ebe77..4597ceb 100644
--- a/src/mathed/MathMacro.cpp
+++ b/src/mathed/MathMacro.cpp
@@ -203,6 +203,8 @@ MathMacro::MathMacro(MathMacro const & that)
        : InsetMathNest(that), d(new Private(*that.d))
 {
        d->updateChildren(this);
+       if (d->macro_)
+               const_cast<MacroData *>(d->macro_)->setSymbol(0);
 }
 
 
@@ -213,6 +215,8 @@ MathMacro & MathMacro::operator=(MathMacro const & that)
        InsetMathNest::operator=(that);
        *d = *that.d;
        d->updateChildren(this);
+       if (d->macro_)
+               const_cast<MacroData *>(d->macro_)->setSymbol(0);
        return *this;
 }
 

Reply via email to