Le 06/06/2015 18:12, Enrico Forestieri a écrit :
On Sat, Jun 06, 2015 at 03:23:48PM +0200, Kornel Benko wrote:

Am Samstag, 6. Juni 2015 um 13:13:22, schrieb Enrico Forestieri <for...@lyx.org>
+void InsetMathHull::usedMacros(MathData const & md, MacroNameSet & macros) 
const
+{
+       for (size_t i = 0; i < md.size(); ++i) {
+               MathMacro * mi = const_cast<MathMacro 
*>(md[i].nucleus()->asMacro());
+               if (mi) {
+                       macros.insert(mi->name());
+                       usedMacros(mi->definition(), macros);

I would change the order, to get the used macro first.

No, that is correct. The top level macro has to appear in the last position.

I failed to understand why that was not working but, most probably, it has
to do with the fact not all data is copied over to a cloned buffer.
However, I found a different way for collecting only the macros used
in a given math inset, so I did not investigate it further.

The attached patch for stable works for me and avoids the size explosion
when a very lot of macros are defined in a document. I count on Guillaume
to give it a thourough test. If he doesn't find glitches I will feel
confident about proposing to apply it for 2.1.4.


Obvious one to test for

Attachment: lyx-preview-macros-2-sigsegv.lyx
Description: application/lyx

Reply via email to