summaryrefslogtreecommitdiff
path: root/sal/cppunittester/cppunittester.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sal/cppunittester/cppunittester.cxx')
-rw-r--r--sal/cppunittester/cppunittester.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index a760ecf8ff41..0a833de5fba2 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -254,9 +254,14 @@ public:
// call the initialize methods of the CppUnitTestPlugIns that
// we statically link to the app executable.
#else
- CppUnit::PlugInManager manager;
+ // The PlugInManager instance is deliberately leaked, so that the dynamic libraries it loads
+ // are never unloaded (which could make e.g. pointers from other libraries' static data
+ // structures to const data in those libraries, like some static OUString cache pointing at
+ // a const OUStringLiteral, become dangling by the time those static data structures are
+ // destroyed during exit):
+ auto manager = new CppUnit::PlugInManager;
try {
- manager.load(testlib, args);
+ manager->load(testlib, args);
} catch (const CppUnit::DynamicLibraryManagerException &e) {
std::cerr << "DynamicLibraryManagerException: \"" << e.what() << "\"\n";
#ifdef _WIN32