Only one signal per object?

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Oct 18 18:16:29 PDT 2011


I've ran into an awful bug right now (probably not related to your
module). It basically comes down to this inside of a "Widget"
constructor:

    this(Widget parent)
    {
        super(parent);

        void test()
        {
            msgbox(this.position);
        }

        parent.onMouseLDown.connect( { this.position;  });
        parent.onMouseLDown.connect( { test(); });
    }

If I comment out the first connect call I'll get an access violation
when 'test()' tries to access the "position" field. The order of the
two calls doesn't seem to affect the bug. I can't recreate the bug in
a simple test-case though.. :/

Oh btw, there's a couple of failing unittests in your signal module
when compiling with " -g  -debug -w -wi":

object.Exception at signalsnew.d(679): Handler is not connected
core.exception.AssertError at signalsnew(950): unittest failure
core.exception.AssertError at signalsnew(968): unittest failure


More information about the Digitalmars-d-learn mailing list