summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2016-09-15 12:27:28 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2016-10-11 13:56:22 +0200
commit9fa4eff9be5e440099517a522a83e20debaf2955 (patch)
tree6ac23f08cb1902fb021bf470144e213df0b4b886 /configmgr
parented646dc595b2ee5248b0994a2b44a7a5a7bfbbd5 (diff)
profilesafe: Enhancements to BackupFileHelper
Added helper class to allow easy creation/deployment of backups of a file. It works like a 'stack' of backups, supports easy add/remove/delete of last entry (LIFO). Added some work top allow opening dialogs in DeInit under linux. Change-Id: Idacec97ec2f097af9bd22a8a67b410c7677d17f1
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/components.cxx43
1 files changed, 33 insertions, 10 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index f7c473c53899..a193da06b167 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -613,25 +613,48 @@ Components::Components(
Components::~Components()
{
- flushModifications();
+ SAL_WARN("configmgr", "################# Components::~Components() #####################");
+
+ // get flag if _exit was already called which is a sign to not to secure user config
+ const bool bExitWasCalled(comphelper::BackupFileHelper::getExitWasCalled());
+
+#ifndef WNT
+ // we can add a SAL_WARN here for other systems where the destructor gets called after
+ // an _exit() call - which should not happen. Still safe - the getExitWasCalled() is
+ // used, but a hint that _exit behaves different on a system
+ SAL_WARN_IF(bExitWasCalled, "configmgr", "Components::~Components() called after _exit() call");
+#endif
+
+ if (bExitWasCalled)
+ {
+ osl::MutexGuard g(*lock_);
+
+ if (writeThread_.is())
+ {
+ writeThread_->join();
+ }
+ }
+ else
+ {
+ flushModifications();
+ }
+
for (WeakRootSet::iterator i(roots_.begin()); i != roots_.end(); ++i) {
(*i)->setAlive(false);
}
- // test backup of registrymodifications (currently off)
- static bool bFeatureSecureUserConfig(false);
+ // test backup of registrymodifications
+ static bool bFeatureSecureUserConfig(true);
- if (bFeatureSecureUserConfig && ModificationTarget::File == modificationTarget_ && !modificationFileUrl_.isEmpty())
+ if (!bExitWasCalled &&
+ bFeatureSecureUserConfig &&
+ ModificationTarget::File == modificationTarget_ &&
+ !modificationFileUrl_.isEmpty())
{
static sal_uInt16 nNumCopies(5);
comphelper::BackupFileHelper aBackupFileHelper(modificationFileUrl_, nNumCopies);
- aBackupFileHelper.tryPush();
- static bool bTryPop(false);
- if (bTryPop)
- {
- aBackupFileHelper.tryPop();
- }
+ aBackupFileHelper.tryPush();
}
}