Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.3.1
Description
We have a problem with the fact that Qt5 apparently doesn't offer any means to explicitly deregister/delete custom QTextCodecs any more. The problems manifest in the context of DLL unloading where you can run into the situation that the DLL you defined the codecs in gets unloaded, thus the virtual table for your objects points nowhere, then at a later point Qt tries deleting the codecs, which will of course access this no-longer existent virtual table and crash (although the objects themselves are still OK). One instance where this problem definitely manifests is when building ActiveX-DLLs using your idc.exe.
In Qt4, we avoided this problem cleanly by deleting the codecs when the DLL was unloaded via its atexit-handlers. In Qt5 this seems no longer possible and I can't see any halfway clean workarounds. There should be a way to tell Qt that certain codecs are no longer available, be it via the QTextCodec destructor or an explicit deregistering method.
The problem of unloading DLLs leaving dangling virtual table pointers should be well documented on the internet. The program where this happens on our side consists of a large number of DLLs and I susped the problem only manifests if the plugin codecs are created in a DLL rather than an EXE, so creating an example program is not practical in this case. The same effect also happens if you create a custom QMimeData object and have it set in the windows clipboard on program termination.
Attachments
Issue Links
- relates to
-
QTBUG-56203 QTextCodec should be able to be implemented in a user made plugin
- Closed