[sigc] 2.0.10 completely breaks recursive signals



In the changelog for version 2.0.10 I see this:
* When signal handlers are connected made during an emit
  of the same signal, prevent them from being called in the
  same emit, to prevent infinite loops.

However it seems that this change completely breaks the ability to emit a signal recursively. The following example illustrates the problem. The expected behavior is that slot() to be called 4 times, but on 2.0.10 it gets called only once. Note that I don't connect a slot during the signal emission.

#include <sigc++/sigc++.h>
#include <iostream>

class Test : public sigc::trackable
{
public:
	Test() : m_recursionLimit(4) {
		m_signal.connect(sigc::mem_fun(*this, &Test::slot));
	}
	
	void signal() { m_signal.emit(); }
	
	void slot() {
		std::cout << "slot" << std::endl;
		if (--m_recursionLimit > 0) {
			signal();
		}
	}
private:
	int m_recursionLimit;
	sigc::signal0<void> m_signal;
};

int main()
{
	Test test;
	test.signal();
}




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