[Issue 11594] synchronized causing segfault instead of Error.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 5 14:58:28 PDT 2017


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

--- Comment #2 from Shammah Chancellor <shammah.chancellor at gmail.com> ---
(In reply to Vladimir Panteleev from comment #1)
> I can't reproduce this with either today's compiler or 2.064.
> 
> In your code, you have:
> 
> private Object mut;// = new Object();
> 
> Does that mean that you instantiate it somewhere? Because if it's not
> instantiated (i.e. your code is ran verbatim), it does result is a
> segmentation fault as you described, but only because the object used for
> locking is null.
> 
> If you can still reproduce this today and can provide a complete test case,
> please reopen.

The issue is that when compiled in debug mode, the "in" contract on
core.sync.mutex is not checked.  This should generate an exception detailing
where the error was made when you try to synchronize on an uninitialized
object, rather than a segfault (when in debug mode)

--


More information about the Digitalmars-d-bugs mailing list