Nicolas Goutte Posted February 11, 2022 Share Posted February 11, 2022 We are currently limited by the problem that during a menu command only a limited number of VW files can be opened, because, even if are closing them, they are not immediately closed, but only when the menu command is done. Similarly, such an operation cannot be done either as a migration manager callback. Does somebody knows a way to get around this? Quote Link to comment
Nicolas Goutte Posted February 11, 2022 Author Share Posted February 11, 2022 (edited) The code we are trying is similar to this one. (The crash comes in both cases, the #if 1 case (real documents) or the #else case (empty documents). using namespace VectorWorks::Filing; #if 1 // Opening real documents of Libraries\Default in the VW program folder IFolderIdentifierPtr libraryDefaultsIdentifiier(IID_FolderIdentifier); libraryDefaultsIdentifiier->Set(kDefaultsFolder, false); class Listener : public IFolderContentListener { public: EFolderContentListenerResult VCOM_CALLTYPE OnFolderContent(IFolderIdentifier* pFolderID) override { return eFolderContentListenerResult_Continue; } EFolderContentListenerResult VCOM_CALLTYPE OnFileContent(IFileIdentifier* pFileID) override { TXString path; pFileID->GetFileFullPath(path); if (path.ReverseFind(".vwx") >= 0) paths.Append(path); return eFolderContentListenerResult_Continue; } TXStringArray paths; }; Listener listener; libraryDefaultsIdentifiier->EnumerateContents(&listener, true); for (const auto& path : listener.paths) { IFileIdentifierPtr pathFileIdentifier(IID_FileIdentifier); pathFileIdentifier->Set(path); gSDK->OpenDocumentPath(pathFileIdentifier, false); gSDK->CloseDocument(); } #else // Opening only empty documents for (int i = 0; i < 100; i++) { gSDK->OpenDocumentPath(nullptr, false); gSDK->CloseDocument(); } #endif Edited February 11, 2022 by Nicolas Goutte Quote Link to comment
Hans Martin Kern Posted February 14, 2022 Share Posted February 14, 2022 @VW Inc. - maybe there is a special GS_Kludge call to give VW some time to actually close the document? Quote Link to comment
Maarten DE Posted February 14, 2022 Share Posted February 14, 2022 If I remember correctly, we had to add a Progress dialog for our bulk translation of files, otherwise VW crashed. But this issue was almost 10 years ago, not sure it's still an issue. Also, I've found this in our code, it might be the fix to the same issue you are having? gSDK->CloseDocument(); gSDK->HandlePendingUpdatesAndActivates(); //workaround for bug in OnFileContent: to trigger closedocument 3 Quote Link to comment
Nicolas Goutte Posted February 15, 2022 Author Share Posted February 15, 2022 12 hours ago, Maarten DE said: gSDK->CloseDocument(); gSDK->HandlePendingUpdatesAndActivates(); //workaround for bug in OnFileContent: to trigger closedocument Thank you for the trick. It makes indeed a difference. 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.