Hi, all.
I found a very difficult to debug problem in wt (version 2.2.3).
It sounds like: sporadic crashes in signal/slot handling subsystem in wt.

Finally I found that the problem is caused by wt API misused.
What I did was similar to:
 
Wt::WText* text1 = new Wt::WText(<parent>);
text1->clicked.connect(<slot>);

Wt::WText* text2 = new Wt::WText(<parent>);
text2->clicked = text1->clicked;

What I wanted was to call text1's <slot> when text2 is clicked.
And it really worked this way.
If after this at some point of time <parent> that contained text2 was deleted - 
crash happened.

The problem seems to be caused by "copy by assignment" of signals.
This problem wouldn't take place if wt was designed to prohibit usage errors 
like this (however the usage error from user POV is not so obvious).

This case can be protected with boost::noncopyable with a patch like this:


Index: WSignal
===================================================================
--- WSignal     (revision 10914)
+++ WSignal     (working copy)
@@ -11,6 +11,7 @@
 #include <bitset>
 #include <boost/signal.hpp>
 #include <boost/bind.hpp>
+#include <boost/utility.hpp>
 
 namespace Wt {
 
@@ -67,7 +68,7 @@
  * current sender (since boost does not pass the sender, we need to
  * keep a stack of them in the current thread context).
  */
-class WT_API SignalBase
+class WT_API SignalBase : public boost::noncopyable
 {
 public:
   virtual ~SignalBase();


I think library maintainers know their product better than me and they 
definitely know places where similar issue can occur.
I wish if they fix relevant parts of library.

Regards, Andrii.

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to