gtreshchev / RuntimeArchiver

Runtime Archiver plugin for Unreal Engine. Cross-platform archiving and unarchiving directories and files. Supports Zip, Oodle, Tar, LZ4 and GZip formats.
MIT License
93 stars 18 forks source link

OnComplete called before archiving is completed and crashing #8

Open kallik93 opened 1 week ago

kallik93 commented 1 week ago

ZipBlueprint I am trying to zip all files of a directory. I tried using both AddEntriesFromStorageand AddEntriesFromStorageDirectory. It seems that the OnCompleteevent is called immediately, before the archiving is complete, because some times if I wait after the OnCompleteevent, the zip is created correctly. Also if I add the CloseArchivenode after ![ZipBlueprint](https://github.com/user-attachments/assets/f206fd96-3eef-42df-93c1-5b16103a03c6)it causes an error (even when the zip is extracted correctly): Error: Blueprint Runtime Error: "Accessed None trying to read property CallFunc_CreateRuntimeArchiver_ReturnValue". Node: Close Archive Graph: EventGraph Function: Execute Ubergraph W Main Menu Blueprint: W_MainMenu

Sometimes, if the file is larger (example 100Mb) the engine crashes even before I close the application, to this line (miniz.c , line 5938): if ((int)pState->m_pZip->m_pWrite(pState->m_pZip->m_pIO_opaque, pState->m_cur_archive_file_ofs, pBuf, len) != len)

with the error:

Unhandled exception at 0x000002A60A28594C (UnrealEditor-RuntimeArchiver-Win64-Debug.dll) in UnrealEditor-Win64-Debug.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

gtreshchev commented 1 week ago

The first thing that catches my attention is that you're not setting the archiver instance as a strong reference, which means the garbage collector will collect it prematurely. You could, for example, assign it to a separate variable in Blueprints right after its creation, as shown in the Blueprint examples, and then try again