]> git.lyx.org Git - features.git/commit
Possible fix for the mystery crash, which is bug #9049.
authorRichard Heck <rgheck@lyx.org>
Thu, 7 Aug 2014 19:00:35 +0000 (15:00 -0400)
committerRichard Heck <rgheck@lyx.org>
Fri, 15 Aug 2014 14:44:37 +0000 (10:44 -0400)
commit54c2ab2732f8094c0c119618d5b0e9a625ffb262
tree64890910ac17820e65ed2fd9b6485cd991e556ca
parent88ce7bd5d4c51ef69a65cecbd176f7f30bfe38c3
Possible fix for the mystery crash, which is bug #9049.

Investigation of bug #9236 showed that crash to be due to a Paragraph's
holding a dangling pointer to an old and deleted Layout after the
DocumentClass was reset. Since the backtraces look almost identical, it
seems likely that we have the same problem here.

Since this crash seems almost always to involve tables, I looked at the
code in switchBetweenClasses() and found that the Paragraphs that belong
to "hidden" table cells are not seen by the initial recursion using a
ParIterator: It skips right over them. This was confirmed by test code
suggested by Enrico, with results reported in Trac.

The present patch attempts to deal with this problem in the second
recursion, over Insets. When we see an InsetTabular, we call a new
routine that recurses through the cells, looking for hidden ones. If it
finds a hidden one, it then resets the Layout for the cell's Paragraphs
(there should be only one, but we do not make any assumptions) to the
PlainLayout that belongs to the new DocumentClass. This is good enough,
since such cells never have content.

There is extensive discussion of the patch here:
  https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg185095.html
Additional testing by Enrico and me confirmed the existence of the
dangling pointer.
src/CutAndPaste.cpp
src/insets/InsetTabular.cpp
src/insets/InsetTabular.h