mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
ead697d4b6
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.
43 lines
601 B
C++
43 lines
601 B
C++
// -*- C++ -*-
|
|
/**
|
|
* \file shared_ptr.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Peter Kümmel
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef LYX_SHARED_PTR_H
|
|
#define LYX_SHARED_PTR_H
|
|
|
|
#ifdef LYX_USE_TR1
|
|
|
|
#include <memory>
|
|
|
|
#ifdef __GNUC__
|
|
#include <tr1/memory>
|
|
#endif
|
|
|
|
namespace lyx
|
|
{
|
|
using std::tr1::shared_ptr;
|
|
using std::tr1::const_pointer_cast;
|
|
}
|
|
|
|
#else
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
namespace lyx
|
|
{
|
|
using boost::shared_ptr;
|
|
using boost::const_pointer_cast;
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
#endif
|