Uploaded image for project: 'Swift'
  1. Swift
  2. SR-9183

Memory leak in `is` type-casting pattern in switch

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:
    • Environment:

      Xcode 10.0 / Swift 4.2

      Description

      The following code seems to leak `toVC`:
       

      public func navigationController(
              _ navigationController: UINavigationController,
              animationControllerFor operation: UINavigationControllerOperation,
              from fromVC: UIViewController,
              to toVC: UIViewController
          ) -> UIViewControllerAnimatedTransitioning? {
              switch (operation, fromVC, toVC) {
              case (.push, _, is ElementwiseAppearTransitionViewController):
                  return ElementwiseAppearTransition()
              default:
                  return nil
              }
      }
      

      I accept that there's a chance this is related to my own code, but since a small change in this code (see attachment) fixed the leak, I felt it was worth a bug report. I haven't been able to find a reduced example yet unfortunately. Let me know if you want me to explore a particular cause or need more input.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            Thomvis Thomas Visser
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: