Quantcast
Channel: Adobe Community : Popular Discussions - InDesign SDK
Viewing all articles
Browse latest Browse all 78596

[CS5.5/CS6] what causes a kImportAndPlaceCmdBoss to throw an exception with broken links?

$
0
0

I have a problem in both CS5.5 and CS6 on MacOS X.

 

During a drag operation onto an InDesign document, I import and place some images onto a page. This normally works without issue except in one case. The problem case is when I'm trying to import an image that is the same file path as a broken link on the document. This will crash InDesign everytime.

 

Let me provide some details.

 

First, I create an InDesign document, drag some images from the Finder and place them on the page and save the InDesign document to file. Now I go to the Finder and delete the images (or just move them to a different Folder). I then go back to InDesign and look at the Links panel where the red stop signs now appear near the images to show that the links are broken.

 

Next I go to a panel that I'm working on where I can drag an item from the panel and onto the InDesign document page. In this I have a ProcessDragDropCommand method that over rides the method in the CDragDropTargetFlavorHelper class, and during that method it copies the images that I just deleted back into their original locations on the file system.

 

After copying the files, the process then tries to import one of the images into a new frame using the PlaceFileInFrame method from the InDesign SDK file SDKLayoutHelper.cpp. This method creates a kImportAndPlaceCmdBoss and when executing the line:

 

if (CmdUtils::ProcessCommand(importAndPlaceCmd) != kSuccess) {

 

causes an exception that appears in the crash report as:

 

Exception Type: EXC_BAD_ACCESS (SIGBUS)

Exception Codes: KERN_PROTECTION_FAILUE at 0x0000000000000000

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

 

with a stack trace that points to the CmdUtils::ProcessCommand() line mentioned above.

 

I've tried relinking the images before the import and place, but that still doesn't work. If I break the process up so that in one drag event I copy the missing files back into place and relink them, then in a second drag event I then do an import and place it all works okay. It's just when I try the full task of copy images into place in the file system, relink the images on the InDesign document and then import and place an image in a new frame on the InDesign page that the exception is appearing.

 

Instead of the kImportAndPlaceCmdBoss I've also tried the kImportAndLoadPlaceGunCmdBoss with the same problem.

 

-

 

Interestingly, in the SDKLayoutHelper method PlaceFileInFrame that I'm using, there's a pragma message:

 

#pragma message("LINKREWORK: Temporary, fix this up later!")

// TODO: LINKREWORK fix.

 

From the wording I'm wondering if this is related to the problem that I'm seeing. In which case does anyone know what this fix might entail?

 

I've tried tried relinking using ReinitResource and UpdateLinks methods that are a part of the ILkniFacade but that doesn't seem to help stop the crash.

 

-

 

Oddly, I can generate a strange and maybe related error (that doesn't use my plugins and just the raw InDesign functionality) if I do something like:

 

In InDesign, create an InDesign document.

From the Finder, drag some images onto the InDesign document page.

In InDesign, save the document.

In the Finder, rename the folder containing the images.

In InDesign, check that the links really are broken with the red stop signs appearing.

In the Finder, rename the folder containing the images back to what it was before.

(Extra Step)

In the Finder, redrag the same images that you did before onto the InDesign page.

 

This will cause InDesign to throw up the following error message:

 

Either the file does not exist, you do not have permission, or the file may be in use by another application

 

Of course, if in the above you introduce an Extra Step where you just go back to InDesign and do nothing. InDesign will relink the once missing images, so that when you go back to the Finder to drag the images there's now no problem.

 

This is almost like InDesign needs a few IdleTasks in order to sort out its perception of the file system. If that's the case then I'm a bit stuck as I'm trying to do everything during a single drag operation and there's no chance of any IdleTasks occuring.

 

-

 

Any ideas?


Viewing all articles
Browse latest Browse all 78596


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>