Only remove the view from the set of views that are being Mirror-drawn when you're actually done reflecting on it

The previous code would always remove the view on exit, even if it had not previously added it (default: case of the switch)

In simple cases, this didn't really matter, but if you caused the logger to be reinvoked on self in a loop, then you would end up removing the view before you were done looping over it, and eventually run out of stack space

Fixes rdar://19558026



Swift SVN r24737
This commit is contained in:
Enrico Granata
2015-01-26 22:45:47 +00:00
parent 9489605a8f
commit beedb4aa7a

View File

@@ -107,11 +107,11 @@ struct _NSViewMirror : MirrorType {
_v.cacheDisplayInRect(bounds, toBitmapImageRep: b)
result = .Some(.View(b))
}
_NSViewMirror._views.removeObject(_v)
default: ()
}
_NSViewMirror._views.removeObject(_v)
return result
} }