[libsigcplusplus] signal_impl::clear(): Really avoid erasing the slots prematurely



commit abf29c46861da4c81237644342e3399312f96eae
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Thu Dec 8 13:33:11 2016 +0100

    signal_impl::clear(): Really avoid erasing the slots prematurely
    
    The call signal_impl_exec_holder(this) creates a signal_impl_exec_holder
    which is immediately destroyed. It does not stop signal_impl::notify() from
    erasing the slots. Create a signal_impl_exec_holder that exists until the
    end of clear().

 sigc++/signal_base.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/sigc++/signal_base.cc b/sigc++/signal_base.cc
index 8081b2e..a3dabdc 100644
--- a/sigc++/signal_base.cc
+++ b/sigc++/signal_base.cc
@@ -65,7 +65,7 @@ signal_impl::clear()
   // Don't let signal_impl::notify() erase the slots. It would invalidate the
   // iterator in the following loop.
   const bool saved_deferred = deferred_;
-  signal_impl_exec_holder(this);
+  signal_impl_exec_holder exec(this);
 
   // Disconnect all connected slots before they are deleted.
   // signal_impl::notify() will be called and delete the self_and_iter structs.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]