diff options
-rw-r--r-- | configmgr/source/components.cxx | 8 | ||||
-rw-r--r-- | configmgr/source/rootaccess.cxx | 21 | ||||
-rw-r--r-- | configmgr/source/rootaccess.hxx | 8 |
3 files changed, 20 insertions, 17 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index d4b3130ca9ed..ec2c0a6d00bb 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -504,16 +504,12 @@ css::beans::Optional< css::uno::Any > Components::getExternalValue( return value; } -int tempHACK = 0; - Components::Components( css::uno::Reference< css::uno::XComponentContext > const & context): context_(context) { lock_ = lock(); - tempHACK = 1; - OSL_ASSERT(context.is()); RTL_LOGFILE_TRACE_AUTHOR("configmgr", "sb", "begin parsing"); parseXcsXcuLayer( @@ -592,7 +588,9 @@ Components::Components( Components::~Components() { flushModifications(); - tempHACK = 0; + for (WeakRootSet::iterator i(roots_.begin()); i != roots_.end(); ++i) { + (*i)->setAlive(false); + } } void Components::parseFileLeniently( diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx index 4ae38c43797a..47f2c2a97992 100644 --- a/configmgr/source/rootaccess.cxx +++ b/configmgr/source/rootaccess.cxx @@ -77,7 +77,7 @@ RootAccess::RootAccess( Components & components, rtl::OUString const & pathRepresentation, rtl::OUString const & locale, bool update): Access(components), pathRepresentation_(pathRepresentation), - locale_(locale), update_(update) + locale_(locale), update_(update), finalized_(false), alive_(true) { lock_ = lock(); } @@ -130,10 +130,15 @@ bool RootAccess::isUpdate() const { return update_; } +void RootAccess::setAlive(bool b) { + alive_ = b; +} + RootAccess::~RootAccess() { osl::MutexGuard g(*lock_); - getComponents().removeRootAccess(this); + if (alive_) + getComponents().removeRootAccess(this); } Path RootAccess::getRelativePath() { @@ -291,24 +296,20 @@ void RootAccess::removeChangesListener( } } -extern int tempHACK; - void RootAccess::commitChanges() throw (css::lang::WrappedTargetException, css::uno::RuntimeException) { #if OSL_DEBUG_LEVEL > 0 OSL_ASSERT(thisIs(IS_UPDATE)); #endif + if (!alive_) + { + return; + } Broadcaster bc; { osl::MutexGuard g(*lock_); - // OSL_ENSURE(tempHACK, "fucktastic!, seriously busted lifecycles\n"); - if (!tempHACK) - { - return; - } - checkLocalizedPropertyAccess(); int finalizedLayer; Modifications globalMods; diff --git a/configmgr/source/rootaccess.hxx b/configmgr/source/rootaccess.hxx index c1751210c50c..1290519b5d99 100644 --- a/configmgr/source/rootaccess.hxx +++ b/configmgr/source/rootaccess.hxx @@ -86,6 +86,8 @@ public: bool isUpdate() const; + void setAlive(bool b); + protected: virtual rtl::OUString SAL_CALL getImplementationName() @@ -151,14 +153,16 @@ private: rtl::OUString pathRepresentation_; rtl::OUString locale_; - bool update_; Path path_; rtl::Reference< Node > node_; rtl::OUString name_; - bool finalized_; ChangesListeners changesListeners_; boost::shared_ptr<osl::Mutex> lock_; + + bool update_:1; + bool finalized_:1; + bool alive_:1; }; } |