summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/source/fwe/helper/undomanagerhelper.cxx4
-rw-r--r--include/comphelper/flagguard.hxx27
-rw-r--r--include/comphelper/scopeguard.hxx1
3 files changed, 17 insertions, 15 deletions
diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx b/framework/source/fwe/helper/undomanagerhelper.cxx
index c9b68c7f6761..36d84b5ba7f2 100644
--- a/framework/source/fwe/helper/undomanagerhelper.cxx
+++ b/framework/source/fwe/helper/undomanagerhelper.cxx
@@ -29,9 +29,11 @@
#include <tools/diagnose_ex.h>
#include <osl/conditn.hxx>
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+
#include <stack>
#include <queue>
-#include <boost/function.hpp>
namespace framework
{
diff --git a/include/comphelper/flagguard.hxx b/include/comphelper/flagguard.hxx
index 30106c16ee94..7ab88e4d98a1 100644
--- a/include/comphelper/flagguard.hxx
+++ b/include/comphelper/flagguard.hxx
@@ -26,15 +26,13 @@
namespace comphelper
{
-
-
//= FlagRestorationGuard
class COMPHELPER_DLLPUBLIC FlagRestorationGuard : public ScopeGuard
{
public:
FlagRestorationGuard( bool& i_flagRef, bool i_temporaryValue, exc_handling i_excHandling = IGNORE_EXCEPTIONS )
- :ScopeGuard( ::boost::bind( RestoreFlag, ::boost::ref( i_flagRef ), !!i_flagRef ), i_excHandling )
+ : ScopeGuard(RestoreFlag(i_flagRef), i_excHandling)
{
i_flagRef = i_temporaryValue;
}
@@ -42,10 +40,19 @@ namespace comphelper
~FlagRestorationGuard();
private:
- static void RestoreFlag( bool& i_flagRef, bool i_originalValue )
+ // note: can't store the originalValue in a FlagRestorationGuard member,
+ // because it will be used from base class dtor
+ struct RestoreFlag
{
- i_flagRef = i_originalValue;
- }
+ bool & rFlag;
+ bool originalValue;
+ RestoreFlag(bool & i_flagRef)
+ : rFlag(i_flagRef), originalValue(i_flagRef) {}
+ void operator()()
+ {
+ rFlag = originalValue;
+ }
+ };
};
@@ -55,18 +62,12 @@ namespace comphelper
{
public:
explicit FlagGuard( bool& i_flagRef, exc_handling i_excHandling = IGNORE_EXCEPTIONS )
- :ScopeGuard( ::boost::bind( ResetFlag, ::boost::ref( i_flagRef ) ), i_excHandling )
+ : ScopeGuard( [&i_flagRef] () { i_flagRef = false; }, i_excHandling)
{
i_flagRef = true;
}
~FlagGuard();
-
- private:
- static void ResetFlag( bool& i_flagRef )
- {
- i_flagRef = false;
- }
};
diff --git a/include/comphelper/scopeguard.hxx b/include/comphelper/scopeguard.hxx
index 4f64d5bf08b6..f120cd7319c5 100644
--- a/include/comphelper/scopeguard.hxx
+++ b/include/comphelper/scopeguard.hxx
@@ -22,7 +22,6 @@
#include <comphelper/comphelperdllapi.h>
#include <boost/function.hpp>
-#include <boost/bind.hpp>
namespace comphelper {