www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19842] New: std.signals Segfault when connecting with a lambda

https://issues.dlang.org/show_bug.cgi?id=19842

          Issue ID: 19842
           Summary: std.signals Segfault when connecting with a lambda
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: codemyst outlook.com

When passing a lambda instead of a delegate to connect, it causes the app to
segfault.

Tested with DMD 2.085.1.

Here's the most basic sample app that will reproduce the issue:

==========
import std.signals;
import std.stdio;

class Test
{
    mixin Signal!(int);

    void run ()
    {
        emit (1);
    }
}

class Tester
{
    void initialize ()
    {
        Test test = new Test ();
        test.connect ((int a) => trigger (a));
    }

    void trigger (int a)
    {
        writeln (a);
    }
}

void main ()
{
    Tester t = new Tester ();
    t.initialize ();
}
==========

--
May 02 2019