Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

DKImageShape - Drag and Drop - CGContextSetCTM: invalid context 0x0 #45

@fblecha

Description

@fblecha

Machine: mac 10.15.3
Xcode: 11.3.1

Summary: Anyone else seeing issues with DnD for images in DrawKit, post catalina/xcode11?

I started seeing this bug crop up recently with drag-n-drop operations, specifically once I a place an image on a DKDrawingView and start dragging it around.

Using default DrawKit primitives (box, line, etc.) does not produce this issue.

I have to set the environment variable "CG_CONTEXT_SHOW_BACKTRACE" to produce the stack trace below. Afaict, everything still seems to work properly.

It happens regardless if it's in a DKShapeGroup.

Image is loaded as a literal from an asset catalog, as a universal PDF.

Stacktrace:

2020-02-17 09:56:15.559928-0700 MyApp[49217:5498717] [com.myapp.myapp] CGContextSetCTM: invalid context 0x0. Backtrace:
<-[NSImageRep drawInRect:]+505>
 <-[NSImageRep CGImageForProposedRect:context:hints:]+325>
  <__74-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke+910>
   <-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]+946>
    <__71-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke.1343+693>
     <-[NSImage _usingBestRepresentationForRect:context:hints:body:]+145>
      <-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]+1343>
       <-[DKImageShape drawImage]+579>
        <-[DKImageShape drawContent]+192>
         <-[DKDrawableObject drawContentWithSelectedState:]+189>
          <-[DKShapeGroup drawGroupContent]+400>
           <-[DKShapeGroup drawContent]+118>
            <-[DKDrawableObject drawContentInRect:fromRect:withStyle:]+657>
             <-[DKDrawableObject rectHitsPath:]+636>
              <-[DKDrawableObject pointHitsPath:]+156>
               <-[DKDrawableShape hitSelectedPart:forSnapDetection:]+555>
                <-[DKObjectOwnerLayer snapPoint:toAnyObjectExcept:snapTolerance:]+344>
                 <-[DKObjectOwnerLayer snappedMousePoint:forObject:withControlFlag:]+148>
                  <-[DKDrawableObject snappedMousePoint:withControlFlag:]+155>
                   <-[DKDrawablePath lineCreateLoop:]+818>
                    <-[DKDrawablePath mouseDownAtPoint:inPart:event:]+380>
                     <-[DKObjectCreationTool mouseDownAtPoint:targetObject:layer:event:delegate:]+690>
                      <-[DKToolController mouseDown:]+633>
                       <-[DKDrawingView mouseDown:]+112>
                        <$s13MyApp17CanvasDrawingViewC9mouseDown4withySo7NSEventC_tF+64>
                         <$s13MyApp17CanvasDrawingViewC9mouseDown4withySo7NSEventC_tFTo+47>
                          <-[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:]+4907>
                           <-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:]+2612>
                            <-[NSWindow(NSEventRouting) sendEvent:]+349>
                             <-[NSApplication(NSEvent) sendEvent:]+352>
                              <-[NSApplication run]+707>
                               <NSApplicationMain+777>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions