|
This is because calibre uses SetDllDirectory so that exes it bundles load their implicitly linked dlls from the calibre dll directory. This is a process global setting and cant really be turned off when launching external programs because its not a thread safe API. Sigil can fix this (not easily) by using a stub launcher for its exe which calls setdlldirectory itself and then loads a dll using LoadLibrary() that contains the actual launcher code (this is what calibre on windows does (see bypy/windows/main.c for an example).
In calibre I could fix this by running a worker process for every launch that resets setdlldirectory and then does the actual launching to get around the thread safety issues, but this is both 1) likely to be fragile 2) add a lot of delay to running external programs as the worker will need to spin up both python and qt to use QDesktopServices.openUrl. Or I could use the existing cleanup on exit worker to do this, which fixes 2 since that worker is launched anyway. 1 remains though.
On the other hand I could just ignore the thread safety issues (calibre already resets env vars when launching which have similar thread safety issues).
|