diff options
author | Jörg Barfurth <jb@openoffice.org> | 2001-04-11 07:27:39 +0000 |
---|---|---|
committer | Jörg Barfurth <jb@openoffice.org> | 2001-04-11 07:27:39 +0000 |
commit | 1a1b2db3986e2f50cc1b85850938c71f5c2a647d (patch) | |
tree | 7db7149337ef7e473147786c2978401b958e410b /configmgr | |
parent | 9040f806f0460556cd86259c0148e43def7a83be (diff) |
#86000# CacheWriteScheduler now uses set instead of list to prevent duplicates; Previously we could be left with an invalid iterator
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/treecache/disposetimer.cxx | 19 | ||||
-rw-r--r-- | configmgr/source/treecache/disposetimer.hxx | 8 |
2 files changed, 13 insertions, 14 deletions
diff --git a/configmgr/source/treecache/disposetimer.cxx b/configmgr/source/treecache/disposetimer.cxx index 1a2b86b9146f..c1dcd10a2499 100644 --- a/configmgr/source/treecache/disposetimer.cxx +++ b/configmgr/source/treecache/disposetimer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: disposetimer.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: jb $ $Date: 2001-04-09 12:37:50 $ + * last change: $Author: jb $ $Date: 2001-04-11 08:27:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -442,7 +442,7 @@ void OTreeCacheWriteScheduler::runWriter() if (it->isValid()) { vos::ORef< OOptions > xTaskOption = *it; - ++it; // advance iterator now iterator -writeOneTree ...may erase current element + ++it; // advance iterator now - writeOneTree.. may erase current element try { writeOneTreeFoundByOption(xTaskOption); @@ -454,8 +454,10 @@ void OTreeCacheWriteScheduler::runWriter() } else { + OSL_ENSURE(false, "Cannot have NULL options in write list"); CFG_TRACE_WARNING_NI("runDisposer: TaskOption not valid"); - it = m_aWriteList.erase(it); + // should erase ? - must not happen + ++it; // at least we wont loop } } // m_aWriteList.clear(); @@ -474,7 +476,7 @@ void OTreeCacheWriteScheduler::writeOneTreeFoundByOption(vos::ORef< OOptions > c { CFG_TRACE_WARNING_NI("- Data container (TreeInfo) to write not found: Ignoring task"); } - m_aWriteList.remove(_xOptions); + m_aWriteList.erase(_xOptions); } // ----------------------------------------------------------------------------- @@ -483,10 +485,7 @@ bool OTreeCacheWriteScheduler::clearTasks(vos::ORef< OOptions > const& _xOptions osl::MutexGuard aGuard( m_rTreeManager.m_aUpdateMutex ); // sadly list::remove doesn't return an indication of what it did - bool bFound = std::find(m_aWriteList.begin(),m_aWriteList.end(),_xOptions) != m_aWriteList.end(); - - if (bFound) - m_aWriteList.remove(_xOptions); + bool bFound = m_aWriteList.erase(_xOptions) !=0; return bFound; } @@ -531,7 +530,7 @@ void OTreeCacheWriteScheduler::scheduleWrite(vos::ORef< OOptions > const& _xOpti OUSTRING2ASCII(_xOptions->getUser()), OUSTRING2ASCII(_xOptions->getLocale())); // lasy writing - m_aWriteList.push_back(_xOptions); + m_aWriteList.insert(_xOptions); TimeStamp aNewTime = implGetCleanupTime(TimeStamp::getCurrentTime(), m_aCleanupInterval); implStartBefore(aNewTime); diff --git a/configmgr/source/treecache/disposetimer.hxx b/configmgr/source/treecache/disposetimer.hxx index f6c9351d28cb..fcfff1c6a17c 100644 --- a/configmgr/source/treecache/disposetimer.hxx +++ b/configmgr/source/treecache/disposetimer.hxx @@ -2,9 +2,9 @@ * * $RCSfile: disposetimer.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: jb $ $Date: 2001-04-09 12:37:50 $ + * last change: $Author: jb $ $Date: 2001-04-11 08:27:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,7 +76,7 @@ #include <osl/mutex.hxx> #include <vos/timer.hxx> #include <map> -#include <list> +#include <set> namespace uno = ::com::sun::star::uno; namespace lang = ::com::sun::star::lang; @@ -223,7 +223,7 @@ namespace configmgr // (better control) class OTreeCacheWriteScheduler { - typedef std::list<vos::ORef< OOptions > > CacheWriteList; // fire and forget! + typedef std::set< vos::ORef< OOptions >, ltOptions > CacheWriteList; // fire and forget! class Timer : public vos::OTimer { |