Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53634 - in branches/release: boost/signals2/detail libs/signals2/test
From: fmhess_at_[hidden]
Date: 2009-06-04 09:26:30


Author: fmhess
Date: 2009-06-04 09:26:30 EDT (Thu, 04 Jun 2009)
New Revision: 53634
URL: http://svn.boost.org/trac/boost/changeset/53634

Log:
Merged [53599] to release. Fixes #3125.

Text files modified:
   branches/release/boost/signals2/detail/signal_template.hpp | 4 ++--
   branches/release/libs/signals2/test/signal_test.cpp | 29 +++++++++++++++++++++++++++++
   2 files changed, 31 insertions(+), 2 deletions(-)

Modified: branches/release/boost/signals2/detail/signal_template.hpp
==============================================================================
--- branches/release/boost/signals2/detail/signal_template.hpp (original)
+++ branches/release/boost/signals2/detail/signal_template.hpp 2009-06-04 09:26:30 EDT (Thu, 04 Jun 2009)
@@ -288,13 +288,13 @@
         combiner_type combiner() const
         {
           unique_lock<mutex_type> lock(_mutex);
- return _shared_state->combiner;
+ return _shared_state->combiner();
         }
         void set_combiner(const combiner_type &combiner)
         {
           unique_lock<mutex_type> lock(_mutex);
           if(_shared_state.unique())
- _shared_state->combiner = combiner;
+ _shared_state->combiner() = combiner;
           else
             _shared_state.reset(new invocation_state(*_shared_state, combiner));
         }

Modified: branches/release/libs/signals2/test/signal_test.cpp
==============================================================================
--- branches/release/libs/signals2/test/signal_test.cpp (original)
+++ branches/release/libs/signals2/test/signal_test.cpp 2009-06-04 09:26:30 EDT (Thu, 04 Jun 2009)
@@ -265,6 +265,34 @@
   BOOST_CHECK(typeid(unary_signal_type::slot_type::argument_type) == typeid(short));
 }
 
+class dummy_combiner
+{
+public:
+ typedef int result_type;
+
+ dummy_combiner(result_type return_value): _return_value(return_value)
+ {}
+ template<typename SlotIterator>
+ result_type operator()(SlotIterator, SlotIterator)
+ {
+ return _return_value;
+ }
+private:
+ result_type _return_value;
+};
+
+static void
+test_set_combiner()
+{
+ typedef boost::signals2::signal<int (), dummy_combiner> signal_type;
+ signal_type sig(dummy_combiner(0));
+ BOOST_CHECK(sig() == 0);
+ BOOST_CHECK(sig.combiner()(0,0) == 0);
+ sig.set_combiner(dummy_combiner(1));
+ BOOST_CHECK(sig() == 1);
+ BOOST_CHECK(sig.combiner()(0,0) == 1);
+}
+
 int
 test_main(int, char* [])
 {
@@ -275,5 +303,6 @@
   test_extended_slot<int>();
   test_reference_args();
   test_typedefs_etc();
+ test_set_combiner();
   return 0;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk