mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen: Fix infinite destructor loop.
Putting 'this' in a box causes 'this' to be released with the box at the end of the destructor and infinite-loop. Double-retain it to work around this. Gross. Swift SVN r4752
This commit is contained in:
@@ -615,6 +615,9 @@ SILValue SILGenFunction::emitDestructorProlog(ClassDecl *CD,
|
||||
if (DD) {
|
||||
// FIXME: Bump the retain count so that destruction doesn't fire
|
||||
// recursively while passing 'this' around in the destructor body.
|
||||
// FIXME: We have to retain it twice to counter the release that will happen
|
||||
// when the 'this' box is released below. Gross.
|
||||
B.createRetain(DD, thisValue);
|
||||
B.createRetain(DD, thisValue);
|
||||
|
||||
// Make a box for 'this' in the body's scope.
|
||||
|
||||
Reference in New Issue
Block a user