2 Replies Latest reply on Aug 2, 2018 6:12 AM by LeoTaro

    There is something seriously wrong with the SDK - unidentified exception

    peter-petrowicz2 Level 1

      I get some weird exceptions. I tried to track it by some experiments with sample projects and at some point I managed to make it go away just by adding some unused array in some place in the code. My code is a little different and I'm unable to achieve it there. I tried to use other functions but the exception pops up somewhere else. The behavior with unused variable look like a problem with memory overwriting.

      To demonstrate the problem replace SnippetRunnerPlugin::Message body with:

       

      ASErr result = kNoErr;
      //char abc[1024]; ZeroMemory(abc, 1024);
      result = Plugin::Message(caller, selector, message);
      
      
      return result;
      

       

      and in SnippetRunnerPlugin::GoMenuItem replace fAboutPluginMenu handler with:

       

      ASErr result = kNoErr;
      try {
           AINewDocumentPreset settings;
           SDK_ASSERT(sAIDocumentList);
           ai::UnicodeString preset("Print");
           result = sAIDocumentList->GetPresetSettings(preset, &settings);
           aisdk::check_ai_error(result);
           ai::UnicodeString prst;
           AIDocumentHandle document;
           result = sAIDocumentList->New(prst, &settings, kDialogNone, &document);
           aisdk::check_ai_error(result);
           SDK_ASSERT(document);
      }
      catch (ai::Error& ex) {
           result = ex;
      }
      

       

      Now compile plugin in debug, copy it to plugins folder, run Illustrator, go to help->About SDK plugins->Snippet Runner... . Illustrator crashes on sAIDocumentList->New. Now in SnippetRunnerPlugin::Message uncomment the array line. Repeat above steps - new page is being created. Also release version runs successfully, but it's not the case in my code. Is there anything I'm doing wrong?

       

      I used Adobe Illustrator SDK Build 20161110.sdk.95609, VisualStudio 2015, Windows 10, Illustrator CC 22.1 (64-bit).