title: Core Animation: strange display errors during drag and drop after animation
body: <p>I have a Cocoa app that uses a Core Animation for a variety of custom animations (rotation, perspective, etc.). The app lets the user drag files out of the application window on to the Desktop.</p>
  
  <p>Once in a while when I drag a file from my app to the Desktop and wait for about 2 seconds before dropping the file I noticed very strange display errors (see screenshot).</p>
  
  <p>I captured them via a screen recording. They seem to be fragments of an earlier animation done by my app.</p>
  
  <p>I can consistently reproduce it: the bug appears when I have specific other applications running at the same time. Two of those are:</p>
  
  <ul>
  <li>Xcode</li>
  <li>ScreenFlow</li>
  </ul>
  
  <p>Is it possible that those apps also use Core Animation/OpenGL in a way that conflicts with my application (or maybe consumes too much OpenGL memory)?</p>
  
  <p>I initiate the drag operation in the layer hosting view like this:</p>
  
  <pre><code>NSPoint pointOfClick = [self convertPoint:[theEvent locationInWindow] fromView:nil];
  NSImage *image = [NSImage imageNamed:NSImageNameInfo]; // For testing purposes only
  [image setSize:NSMakeSize(50.0, 50.0)];
  
  [self dragImage:image
               at:pointOfClick
           offset:NSZeroSize
            event:theEvent 
       pasteboard:pboard 
           source:self 
        slideBack:NO];
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/foonc.jpg" alt="display errors"> </p>