Mike Scott 0 Posted December 9, 2021 I have a datamodule with imagecollections holding .PNG files. If I compile a Debug build (no packages) all is well. However, a Release build with various packages including vcl;vclx;rtl;vclimg;vclSmp;vclwinX;bindengine; reliably gives trouble. I CoInitialize before and CoUninitialize after the load. The loading mechanism which gives an AV in vcl280.bpl. Image 1 shows what Eurekalog diagnoses. The images are all PNG files. Image 2 shows the source. I get an AV when creating the DatamoduleAlImages or when I get to Application.Run. Share this post Link to post
Anders Melander 1815 Posted December 9, 2021 That's not how you use coInitialize/coUninitialize. First of all check the return value of coInitialize and don't call coUnititialize unless the return status indicated that it succeeded. Read the documentation. And don't call coUninitialize until you are sure that everything using the thread apartment is done with it. Since you're doing this in the main thread and you don't know what else is using it you are best of doing it just before the final end. Normally this is something that would be done in the initialization and finalization sections of a unit. Finally, use coInitializeEx instead. 1 Share this post Link to post
Mike Scott 0 Posted December 10, 2021 Problem solved, thanks. I hope this might help someone else with problems loading images for a datamodule! Cheers -- MIke Share this post Link to post