Constructing a transient singleton class should hold the receiver until complete --------------------------------------------------------------------------------
Key: JRUBY-1769 URL: http://jira.codehaus.org/browse/JRUBY-1769 Project: JRuby Issue Type: Bug Components: Compiler Reporter: Charles Oliver Nutter Assignee: Charles Oliver Nutter Fix For: JRuby 1.1 This is a compile issue relating to the new weakref-based "attached" in a singleton class. The following code: {noformat} class << Object.new; def foo; end; end {noformat} ...can sometimes fail because the new object, referenced only via the "attached" weakref in the new singleton class, may GC before the def is encountered. Because def on a singleton class calls additional methods on the object, this causes a NPE. The fix is to make sure that in all cases, when constructing a singleton class, the compiler keeps the referenced object hard-referenced until the class definition is complete. The implication is that in such an unusual case, the lifetime of the object could only reasonably be the lifetime of the class body. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email