Abdelrazak Younes wrote:
Richard Heck wrote:
The pointer in question is a boost::shared_ptr. This is needed because CutAndPaste saves a copy of the layout with each cut or copied selection. We cannot assume the selection vanishes when the document is closed, so there are two options: (i) keep a list of all the layouts that have ever been used by any document; (ii) used some kind of smart pointer. The latter seems preferable, as the former would waste memory.
(iii) remember layout base class _and_ module in BufferParams. Maybe the solution is to have a global TextClassModule along the global TextClassList instead of having local copies of TextClass? Or integrate the module access to the TextClassList itself?
Changes to BufferParams don't help. The problem is in CutAndPaste, where we keep a copy of the TextClass in use with a given selection. Previously, it just held an index into TextClassList, and extending that would lead to solution (i). I suppose you could have some kind of next TextClass-thingy that kept a list of modules that are in use. But that presumes that the contents of the modules don't change while LyX is running---and I'd like to avoid that, since it makes layout editing a pain in the rear.

Indeed, with the present change, there is no reason one cannot reload a layout file after making changes to it, something that would have been impossible before, and would still be impossible with any index-based solution. This is something that EVERYONE who has EVER done any real work on layouts desperately wants, with Steve Litt being at the head of the line. And the difficulty of creating and modifying layouts is one of the main barriers to LyX's wider acceptance.

I'd say, in fact, that this is the REAL reason to use a shared pointer.

Richard

--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Reply via email to