             activity.popoverPresentationController!.permittedArrowDirections = UIPopoverArrowDirection.up
         }
         
-        viewPlot.stopLoading()
+        finishLoading()
         present(activity, animated:true)
     }
     
+    private func finishLoading()
+    {
+        DispatchQueue.main.async
+        { [weak self] in
+            
+            self?.viewPlot.stopLoading()
+        }
+    }
+    
     //MARK: public
     
     func back()

        else
        {
            UIGraphicsEndImageContext()
            viewPlot.stopLoading()
            
            return
        }

        else
        {
            UIGraphicsEndImageContext()
            finishLoading()
            
            return
        }
