<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 23, 2015, at 6:31 AM, Tadeas Kriz via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hey,<div class=""><br class=""></div><div class="">I am experiencing this strange crashing when capturing an instance of a @objc class (written in swift, but annotated with @objc and subclass of NSObject). It happens when the closure is being assigned and not when called, so the problem is not that the captured value would get deallocated and then the closure called. It happens randomly, sometimes it crashes sooner, sometimes later. I was experiencing this bug in earlier versions of Swift (I think it was Swift 1.2), but now I'm using 2.1 and getting this crash too.</div><div class=""><br class=""></div><div class="">It works well when I change `[unowned x]` to `[weak x]` and then access it by force unwrapping `x!.doSomething()` which leads me to believe it is a bug in Swift, rather than in my code. However before opening a ticket at <a href="http://bugs.swift.org/" class="">bugs.swift.org</a>, I wanted to get more eyes on this to make sure I'm not missing anything.</div></div></div></blockquote><div><br class=""></div><div>Do you have a small test case? Can you file a bug?</div><div><br class=""></div><div>Michael</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">It was also mentioned here:</div><div class=""><a href="http://www.codeproject.com/Articles/791304/Resolving-strong-references-between-Swift-and-Obje" class="">http://www.codeproject.com/Articles/791304/Resolving-strong-references-between-Swift-and-Obje</a><br class=""></div><div class="">here:</div><div class=""><a href="https://www.reddit.com/r/swift/comments/3vhwmj/unowned_bug_in_closure_causes_attempted_to_retain/" class="">https://www.reddit.com/r/swift/comments/3vhwmj/unowned_bug_in_closure_causes_attempted_to_retain/</a><br class=""></div><div class="">and here:</div><div class=""><a href="https://forums.developer.apple.com/thread/9873" class="">https://forums.developer.apple.com/thread/9873</a><br class=""></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=BsPB5S3Z2usbY-2FzcCsd-2F2r4MihYe9FiKHjzH65yItK4silxIKG6U2qd9oWr-2F05srDrY2IzOmKEpPqdptLioZgzYshY1e9jEeVRPS5gHbYlcnTOqrhg7rs-2BdzV-2F5rjVruMbDLD-2F23qJUNZP-2FxAmo1emlH0gze3RPv-2FgPO6QNo7Pwg5G9-2BaZO-2BH5otKMqogiHUMaPkmLpb7MGQJep6s6BNTBoo9PwbErixcxV4ZTJT9uI-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></body></html>