LyX 2.4 -- memory full when trying to copy a math block having boxed expression with 4 levels of nested deep subscript
Alexander Dunlap
alexander.dunlap at gmail.com
Sat May 18 16:37:57 UTC 2024
On Sat, May 18, 2024, at 10:15 AM, Alexander Dunlap wrote:
> On Sat, May 18, 2024, at 9:52 AM, Alexander Dunlap wrote:
>> On Sat, May 18, 2024, at 2:30 AM, Niranjana K M wrote:
>>> Dear LyX developers,
>>> Thank you and congratulations for heading towards much awaited LyX-2.4.
>>> I have been using LyX-2.4-RC1 from last 6 months and yesterday accidentally i caught this strange behavior. And I even installed recently released LyX-2.4 and the behavior persisted in this version also. But i am not facing this problem in LyX-2.3.7.
>>> The problem is, when I try to copy, by selecting and pressing Ctrl+C (or Copy from edit menu), a math block which is boxed and also having deep nested subscripts to at least 4 levels then my computer memory rapidly got consumed to the full (starting from 1GB to ~10GB) and in the end LyX closed with following message.
>>>
>>> $ /usr/local/bin/lyx
>>> Error: Software exception Detected
>>> ----------------------------------------
>>> LyX has caught an exception, it will now attempt to save all unsaved documents and exit.
>>> Exception: std::bad_alloc
>>> Aborted
>>>
>>> Following is the math block which caused it, (LyX code)
>>> \begin_inset Formula
>>> \[
>>> \boxed{v=\left[v_{p}\right]_{a_{0}}}
>>> \]
>>> \end_inset
>>>
>>> The file is also attached in the end and here is the screenshot of the math block.
>>> Screenshot from 2024-05-18 11-43-00.png
>>>
>>> It is a legitimate construction and it gives no problem in LyX-2.3.7 (confirmed).
>>> If either the box is removed or the subscript 0 is removed from *a*, then it has no issues in copying.
>>>
>>> All these versions I mentioned were compiled from source on Gentoo Linux. This LyX-2.4 was compiled with the following configuration,
>>> $ ./configure --without-included-boost
>>> Configuration
>>> Host type: x86_64-pc-linux-gnu
>>> Special build flags: build=release callback-printing use-hunspell use-aspell use-enchant
>>> Bundled libraries: nod
>>> C++ Compiler: g++ (13.2.1)
>>> C++ Compiler flags: -fPIC -O2 -std=c++17
>>> C++ Compiler user flags: -std=c++17 -march=native -O2 -pipe
>>> Linker flags: -rdynamic
>>> Linker user flags:
>>> Qt Frontend:
>>> Qt version: 5.15.11
>>> Packaging: posix
>>> LyX binary dir: /usr/local/bin
>>> LyX files dir: /usr/local/share/lyx
>>>
>>> I loved the new features in LyX-2.4 and don't want to go back to LyX-2.3.7 due to this issue. Please help in this regard.
>>
>> I can reproduce this. I investigated a little and it seems that the problem is that the "while (true)" loop in the splitAndWrapInMText function in InsetMathBox.cpp is never terminating. I believe that the reason for this is that the logic in this function is not correctly identifying the matching XHTML end tag for a given start tag, since it doesn't take into account nested tags properly.
>
> Here is a patch that fixes the problem for me. It needs extensive checking/testing though because I do not know too much about XHTML or what all sorts of input might be seen in this function.
This patch is indeed not good enough, because it fails if there is text inside the tag that contains the tag name. This is another case of the problem in the 2.4 RC's: if you type \left(msub\right)_{0} then it also hangs when you try to copy it. The attached patches attempt to fix this issue but it seems maybe a proper parsing system would be better.....
>
>>
>>
>>>
>>> *Regards*
>>> *Niranjana*
>>> --
>>> lyx-devel mailing list
>>> lyx-devel at lists.lyx.org
>>> http://lists.lyx.org/mailman/listinfo/lyx-devel
>>>
>>>
>>> *Attachments:*
>>> • test.24.lyx
>>
>
>
> *Attachments:*
> • 0001-Improving-logic-in-splitAndWrapInMText.patch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20240518/99d3c299/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2024-05-18 11-43-00.png
Type: image/png
Size: 2400 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20240518/99d3c299/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spiltandwrapimtext-2.patch
Type: text/x-patch
Size: 3157 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20240518/99d3c299/attachment-0001.bin>
More information about the lyx-devel
mailing list