Synchronized object must not be deleted. causes useless error message

Sean Kelly sean at f4.ca
Tue Nov 21 10:02:40 PST 2006


BCS wrote:
> this
> 
> auto o = new Object;
> synchronized(o)
>     delete o;
> 
> causes a runtime error:
> 
> Assertion failure: 'h->monitor" on line 99 in file 'internal\monitor.c'

This is to be expected, as 'delete' destroys the object monitor so it no 
longer exists when the synchronized block completes.  I would consider 
the above to be programmer error, and a runtime message is the most 
appropriate response for this.


Sean



More information about the Digitalmars-d-bugs mailing list