http://d.puremagic.com/issues/show_bug.cgi?id=4147

           Summary: Failing inner expression leaves ghost-reference to
                    outer expression on GC which is errenously finalized
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: webmas...@aj-productions.de


--- Comment #0 from Andreas Jung <webmas...@aj-productions.de> 2010-05-02 
11:14:25 PDT ---
Created an attachment (id=620)
Demonstration of the bug - define "DEMO_FAILURE" during compilation to see the
bug in action.

Using the latest DMD 2.043.

Please refer to the attachment for a complete example. In short...

Given the following expression:
"auto parent = new Parent( new FailingChild() );".

"FailingChild::this()" throws an exception and "Parent::this( ... )" never gets
called.

The problem: The GC tries to finalize "parent", despite it has never been
constructed.

This
- compromised exception safety.
- causes hard-to-find bugs in large scale frameworks, since code is executed in
objects that the programmer is not even aware of.


Without knowing the excact implementation details of the GC, my "guess" on the
problem is: A GC-root to "parent" is added, before "FailingChild::this()" is
evaluated.

My "guess" on the solution: Add the GC-root to "parent" after the inner
expression "FailingChild::this()" is evaluated.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to