We need to delete EditDLL before de-initialize vcl to avoid crash.
Without manually releasing the EditDLL singleton instance, it gets deleted *after* the cppunit does its cleanup, which de-initializes VCL. The problem is, when the EditDLL instance is destroyed, its member GlobalEditData instance deletes the OutputDevice instance that it owns, which in turn accesses font caches in VCL. But by the time we reach that point, VCL is already de-initialized, hence the problem.
This commit is contained in:
@@ -53,6 +53,7 @@ public:
|
||||
ResMgr* GetResMgr() const { return pResMgr; }
|
||||
GlobalEditData* GetGlobalData() const { return pGlobalData; }
|
||||
static EditDLL& Get();
|
||||
static void Release();
|
||||
};
|
||||
|
||||
#define EE_DLL() EditDLL::Get()
|
||||
|
@@ -74,6 +74,7 @@ void Test::setUp()
|
||||
void Test::tearDown()
|
||||
{
|
||||
SfxItemPool::Free(mpItemPool);
|
||||
EditDLL::Release();
|
||||
|
||||
test::BootstrapFixture::tearDown();
|
||||
}
|
||||
@@ -83,8 +84,8 @@ void Test::testConstruction()
|
||||
EditEngine aEngine(mpItemPool);
|
||||
|
||||
// TODO: This currently causes segfault in vcl.
|
||||
// rtl::OUString aParaText = "I am Edit Engine.";
|
||||
// aEngine.SetText(aParaText);
|
||||
rtl::OUString aParaText = "I am Edit Engine.";
|
||||
aEngine.SetText(aParaText);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||
|
@@ -72,18 +72,27 @@
|
||||
#include <editeng/xmlcnitm.hxx>
|
||||
#include <editeng/forbiddencharacterstable.hxx>
|
||||
#include <editeng/justifyitem.hxx>
|
||||
#include <rtl/instance.hxx>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
namespace
|
||||
{
|
||||
class theEditDLL : public rtl::Static<EditDLL, theEditDLL> {};
|
||||
namespace {
|
||||
|
||||
boost::scoped_ptr<EditDLL> pDLL;
|
||||
|
||||
}
|
||||
|
||||
EditDLL& EditDLL::Get()
|
||||
{
|
||||
return theEditDLL::get();
|
||||
if (!pDLL)
|
||||
pDLL.reset(new EditDLL);
|
||||
return *pDLL;
|
||||
}
|
||||
|
||||
void EditDLL::Release()
|
||||
{
|
||||
pDLL.reset();
|
||||
}
|
||||
|
||||
GlobalEditData::GlobalEditData()
|
||||
|
Reference in New Issue
Block a user