Perpeto 5 Posted October 11, 2022 Hallo everyone, I get access violations in my multi-threaded application, if it tries to read a resourcestring. I do not understand why or at least, why this is a problem. If I surround those calls with critical sections, everything is fine. It gets an AV here: Thanks in advance! Share this post Link to post
Dalija Prasnikar 1396 Posted October 11, 2022 Loading resource strings should be thread-safe. Issue probably happens because you are loading string resource to a shared string variable. Without seeing your code it is impossible to tell exactly. Share this post Link to post
Der schöne Günther 316 Posted October 11, 2022 I am loading resource strings from several threads and never had a problem. That doesn't mean it's ok to do so, but I never had anything while you make it sound like an AV is guarenteed to happen unless you surround it with critical sections. Can you create a reproducable sample? Share this post Link to post
DelphiUdIT 176 Posted October 13, 2022 Some time ago I had a similar problem with RESOURCESTRING, both in overwriting (with the VirtualProtect function) and with LOADRESSTRING in multithreading. Since that time I have created a unit in which I perform all the functions of loading the resources and their eventual overwriting by calling it at the end of the initialization of all the other modules, and since then I have not had more problems. I mainly use the function for translation purposes. Share this post Link to post