I included a snippet of sample code [found here:
https://opensource.adobe.com/dc-acrobat-sdk-docs/library/plugin/Plugins_Documents.html ]
into my plug-in code. When executed, after the open dialog is displayed and user selects a file, Acrobat crashes. The same code compiled for Acrobat 64-bit runs without issues.
This test was performed after my plug-in (that runs similar code) crashed in a similar manner. The crash after AVAppOpenDialog started in the most recent release (2023.006.20320). The code did not crash in any of the previous versions of Acrobat.
I know I can replace the AVAppOpenDialog with a Windows file dialog - but would like to know why this is happening only in the latest release.
Any help or insight would be greatly appreciated.
ASPathName OpenPDFFile()
{
//Declare an AVOpenSaveDialogParamsRec object
AVOpenSaveDialogParamsRec dialogParams;
//Create local variables
AVFileFilterRec filterRec, * filterRecP;
AVFileDescRec descRec;
ASPathName* pathName = NULL;
ASFileSys fileSys = NULL;
ASBool bSelected = false;
char errorBuf[256];
//Set up the PDF file filter description
strcpy(descRec.extension, "pdf");
descRec.macFileType = 'PDF ';
descRec.macFileCreator = 'CARO';
//Set attributes that belong to the AVFileFilterRec object
memset(&filterRec, 0, sizeof(AVFileFilterRec));
filterRec.fileDescs = &descRec;
filterRec.numFileDescs = 1;
filterRecP = &filterRec;
//Set attributes that belong to the AVOpenSaveDialogParamsRec object
memset(&dialogParams, 0, sizeof(AVOpenSaveDialogParamsRec));
dialogParams.size = sizeof(AVOpenSaveDialogParamsRec);
dialogParams.fileFilters = &filterRecP;
dialogParams.numFileFilters = 1;
DURING
//Set the AVFileFilterRec object's filterDescription attribute
filterRec.filterDescription = ASTextNew();
ASTextSetEncoded(filterRec.filterDescription, "Adobe PDF Files",
ASScriptToHostEncoding(kASRomanScript));
//Set the AVOpenSaveDialogParamsRec object's windowTitle attribute
dialogParams.windowTitle = ASTextNew();
ASTextSetEncoded(dialogParams.windowTitle, "Select A PDF To Open",ASScriptToHostEncoding(kASRomanScript));
//Display the Open dialog box - pass the address of the ASFileSys object
bSelected = AVAppOpenDialog(&dialogParams, &fileSys, (ASPathName**)&pathName, NULL, NULL);
HANDLER
//Display an error message to the user
ASGetErrorString(ASGetExceptionErrorCode(), errorBuf, 256);
AVAlertNote(errorBuf);
END_HANDLER
//Destroy the ASText object then return
ASTextDestroy(filterRec.filterDescription);
ASTextDestroy(dialogParams.windowTitle);
return bSelected ? *pathName : NULL;
}