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; }
|
ResMgr* GetResMgr() const { return pResMgr; }
|
||||||
GlobalEditData* GetGlobalData() const { return pGlobalData; }
|
GlobalEditData* GetGlobalData() const { return pGlobalData; }
|
||||||
static EditDLL& Get();
|
static EditDLL& Get();
|
||||||
|
static void Release();
|
||||||
};
|
};
|
||||||
|
|
||||||
#define EE_DLL() EditDLL::Get()
|
#define EE_DLL() EditDLL::Get()
|
||||||
|
@@ -74,6 +74,7 @@ void Test::setUp()
|
|||||||
void Test::tearDown()
|
void Test::tearDown()
|
||||||
{
|
{
|
||||||
SfxItemPool::Free(mpItemPool);
|
SfxItemPool::Free(mpItemPool);
|
||||||
|
EditDLL::Release();
|
||||||
|
|
||||||
test::BootstrapFixture::tearDown();
|
test::BootstrapFixture::tearDown();
|
||||||
}
|
}
|
||||||
@@ -83,8 +84,8 @@ void Test::testConstruction()
|
|||||||
EditEngine aEngine(mpItemPool);
|
EditEngine aEngine(mpItemPool);
|
||||||
|
|
||||||
// TODO: This currently causes segfault in vcl.
|
// TODO: This currently causes segfault in vcl.
|
||||||
// rtl::OUString aParaText = "I am Edit Engine.";
|
rtl::OUString aParaText = "I am Edit Engine.";
|
||||||
// aEngine.SetText(aParaText);
|
aEngine.SetText(aParaText);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||||
|
@@ -72,18 +72,27 @@
|
|||||||
#include <editeng/xmlcnitm.hxx>
|
#include <editeng/xmlcnitm.hxx>
|
||||||
#include <editeng/forbiddencharacterstable.hxx>
|
#include <editeng/forbiddencharacterstable.hxx>
|
||||||
#include <editeng/justifyitem.hxx>
|
#include <editeng/justifyitem.hxx>
|
||||||
#include <rtl/instance.hxx>
|
|
||||||
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
|
|
||||||
namespace
|
namespace {
|
||||||
{
|
|
||||||
class theEditDLL : public rtl::Static<EditDLL, theEditDLL> {};
|
boost::scoped_ptr<EditDLL> pDLL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EditDLL& EditDLL::Get()
|
EditDLL& EditDLL::Get()
|
||||||
{
|
{
|
||||||
return theEditDLL::get();
|
if (!pDLL)
|
||||||
|
pDLL.reset(new EditDLL);
|
||||||
|
return *pDLL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditDLL::Release()
|
||||||
|
{
|
||||||
|
pDLL.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalEditData::GlobalEditData()
|
GlobalEditData::GlobalEditData()
|
||||||
|
Reference in New Issue
Block a user