]> git.lyx.org Git - features.git/commit
Deal with memory issue reported some time ago in connection with DocumentClass
authorRichard Heck <rgheck@lyx.org>
Tue, 13 Mar 2012 16:13:31 +0000 (12:13 -0400)
committerRichard Heck <rgheck@lyx.org>
Thu, 31 May 2012 16:34:29 +0000 (12:34 -0400)
commitead697d4b6c7122a2144b96712e6d2a3184f6fd8
tree44e68c65537285f659046cac0db92341b4365c30
parent03da96e0f7f2efe856146ac4c7fb8618bdca7307
Deal with memory issue reported some time ago in connection with DocumentClass
objects. The problem that led to the leak is that these objects can be held in
memory long after the Buffer that created them is gone, mostly due to their
use in the CutStack. So they were previously held in a storage facility, the
DocumentClassBundle. Unfortunately, they were now being created too often,
especially by cloning. It's not really a leak, because they're accessible, but
we weren't ever destroying them.

This new approach uses a shared_ptr instead.

Thanks to Vincent for pointing out const_pointer_cast.
12 files changed:
src/BufferParams.cpp
src/BufferParams.h
src/BufferView.cpp
src/BufferView.h
src/CutAndPaste.cpp
src/CutAndPaste.h
src/DocumentClassPtr.h [new file with mode: 0644]
src/Makefile.am
src/TextClass.cpp
src/TextClass.h
src/support/shared_ptr.h
src/tex2lyx/tex2lyx.cpp