Summary: Static / instance destruction order
           Product: D
           Version: unspecified
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Rene Zwanenburg <> 2012-01-20 
08:16:08 PST ---
We have a situation where a class has a static associative array member, which
is accessed in the destructor. 

If there are still instances left of this class during program shutdown, the GC
deletes them and calls the destructor. At this point the static member appears
to have been deleted, as any operations on the array cause the program to

The aa is non-null, so checking for a null pointer doesn't work. As a
workaround, it's possible to add a static destructor to the class which sets
the aa to null, and check for this in the non-static destructor. 

This is less than ideal, so it would be nice if it's possible to change the
destruction order: First all class instances, then the static data.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to