Copy link to clipboard
Copied
I have a plugin that works fine in the 32bit CS6 version of illustrator. I built the UI in extension builder. When I compile and debug for 64-bit I crash out with this error:
Unhandled exception at 0x000007feee6901e6 in Illustrator.exe: 0xC0000005: Access violation reading location 0x00000000000007fe.
The visual studio log is filled with this:
First-chance exception at 0x000007fefd80a49d in Illustrator.exe: Microsoft C++ exception: csxs::internal::PlugPlugException at memory location 0x0012cf40...
...
...First-chance exception at 0x000007feee6901e6 in Illustrator.exe: 0xC0000005: Access violation reading location 0x00000000000007fe.
Unhandled exception at 0x000007feee6901e6 in Illustrator.exe: 0xC0000005: Access violation reading location 0x00000000000007fe.
The program '[4572] Illustrator.exe: Native' has exited with code -1073741819 (0xc0000005).
The block of code that the debugger stops at is this:
csxs::event::EventErrorCode
SDKPlugPlug::DispatchEvent(const csxs::event::Event* const event)
{
csxs::event::EventErrorCode err = csxs::event::kEventErrorCode_OperationFailed;
if(pFnRemoveEventListener)
/*this is where it stops->*/ err = (*pFnDispatchEvent)(event);
return err;
}
err is equal to "kEventErrorCode_OperationFailed"
And my code that calls the plugplug DispatchEvent is this:
csxs::event::Event event = {"com.adobe.csxs.events.UpdatePanel", csxs::event::kEventScope_Application, "UpdatePanel", NULL, xmlMessage.c_str()};
fPPLib.DispatchEvent(&event);
Anyone got any ideas on where to start with this one? Thanks for reading!
Copy link to clipboard
Copied
What is pFnDispatchEvent? It sounds like a function pointer. I don't know much about the UI Builder stuff unfortunately, we use Qt. The log exceptions don't sound super unusual, we see a lot of exceptions normally thrown inside Illustrator but none that have 'Access violation' or the PlugPlug one.
Copy link to clipboard
Copied
Here's a the function pointer declaration in plugplug.h:
/**
* @brief Dispatches the given event.
*
* @param The event to dispatch.
* @return The error code for this operation.
*
* This method will notify all event listeners which have registered for the type of the
* event plus all event listeners which have registered for all events. The order in
* which the listeners are notified is undeterministic.
* If an exception is thrown by any of the notified event listener it will be silently
* caught and ignored.
*
* @since 2.0
**/
typedef csxs::event::EventErrorCode (*PlugPlugDispatchEventFn)(const csxs::event::Event* const event);
And then in then declared privately in the SDKPlugPlug class you have this:
PlugPlugDispatchEventFn pFnDispatchEvent;
Also, I forgot to mention that fPPLub is an instance of the SDKPlugPlug class.
Copy link to clipboard
Copied
There is an error in the SDKPlugPlug::DispatchEvent code included in the SDK:
| if(pFnRemoveEventListener) | ||
| err = (*pFnDispatchEvent)(event); |
Should be:
| if(pFnDispatchEvent) | ||
| err = (*pFnDispatchEvent)(event); |
But this is unlikely to be causing your problem, especially as it works in 32 bit mode. Can you show the code that generates the event you pass into the DispatchEvent function?
Copy link to clipboard
Copied
You're correct, that change does not fix the problem, but thanks for sharing that.
By "code that generates the event" do you mean like what I posted above or do you mean all the stuff that generates the xml string that I pass to the event. Most of that stuff just looks like this:
char numPref[4];
std::string xmlMessage = "<payload>";
sprintf(numPref,"%d",g->selectedVector); //converts to decimal base.
xmlMessage += "<selectedVector>";
xmlMessage += numPref;
xmlMessage += "</selectedVector><block><enableXmp>";
if(g->enableXmp)
xmlMessage += "true</enableXmp><route>";
else
xmlMessage += "false</enableXmp><route>";
if(g->route)
xmlMessage += "true</route></block>";
else
xmlMessage += "false</route></block>";
xmlMessage += "</payload>";
csxs::event::Event event = {"com.adobe.csxs.events.UpdatePanel", csxs::event::kEventScope_Application, "UpdatePanel", NULL, xmlMessage.c_str()};
fPPLib.DispatchEvent(&event);
Copy link to clipboard
Copied
Hi TheDollarBill,
Would it be possible for you to put a break point in SDKPlugPlug.cpp SDKPlugPlug::Load (line 38)? There are a few of things that I would be good to check,
1: that the Load function is being hit before the dispatch event call. If this is not the case then you are probably missing the initialization code. In the tutorial sample this is done on PostStartup using the TutorialPanelController.
2: that the PlugPlug.dll exists on the path that it is looked for. You can find this out by adding in the line std::string inspectPath = path.GetFullPath().as_UTF8(); to around line 55 then checking that the location of inspectPath
3: Take a note of the memory location that pFnDispatchEvent is set to and then when it is called check that they are the same. If they are not then it probably means that your FlashUIController is being cleared away between its initialization and dispatch being called.
4: that there are no other errors during this function
Let me know how you get on.
Thanks and regards,
Robert.
Illustrator SDK Engineer
Copy link to clipboard
Copied
Awesome. Thanks, Robert! I'll get on it and report back.
Copy link to clipboard
Copied
Okay, so:
1: The load function is being hit before the dispatch event call, but it was hit twice. It loads twice because I have two different instances of the SdkPlugPlug for two different extensions that the .aip interacts with. Everything showed up the same in both passes through the function.
2: the PlugPlug.dll path shows up as C:\Program Files\Adobe\Adobe Illustrator CS6 (64 Bit)\Support Files\Contents\Windows\PlugPlug.dll
3: the memory location showed up as 0x000007fef0d60030 in both the Load function and the Dispatch function but the error message I get is:
Unhandled exception at 0x000007fef0d701e6 in Illustrator.exe: 0xC0000005: Access violation reading location 0x00000000000007fe.
4: No errors during the load function
Copy link to clipboard
Copied
I assume g->selectedVector will always be less than 1000 and that all this code is in the same function. I just wanted to check you weren't doing something like this (i.e. sending an out of scope string pointer to the DispatchEvent function):
char *GetXML()
{
char *xml = "<payload>xxx</payload>";
return xml;
}
void SendEvent()
{
char *xml = GetXML();
csxs::event::Event event = {"com.adobe.csxs.events.UpdatePanel", csxs::event::kEventScope_Application, "UpdatePanel", NULL, xml};
fPPLib.DispatchEvent(&event);
}
Does the xml string look correct in the debugger?
Does it work if you replace xmlMessage with a string constant, i.e.
csxs::event::Event event = {"com.adobe.csxs.events.UpdatePanel", csxs::event::kEventScope_Application, "UpdatePanel", NULL, "<payload><selectedVector>1</selectedVector><block><enableXmp>true</enableXmp><route>true</route></block></payload>"};
fPPLib.DispatchEvent(&event);
If this works then you probably have a VC runtime library conflict somewhere.
Copy link to clipboard
Copied
A handmade string results in no change in the error. I also removed any reference to the Curl libraries I was using in case that was causing any problems. I still get the same problem. I'm just swinging wildly in the dark. Obviously 32 bit works fine and 64 doesn't, but I have no idea why. Any other ideas?
Copy link to clipboard
Copied
It turns out that I had "modified the sample too much" and I was registering my event listeners in place that is not sanctioned by adobe. I moved things around to jive more with the cs6 freegrid sample and I'm mostly opperational now.
Copy link to clipboard
Copied
Hello,
Thank you for pointing this out! This has now been fixed for future SDK releases.
Thanks,
Robert.
Illlustrator SDK Engineer
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more