[Qt-interest] QFileIconProvider "leaks" DLL's (qgifd4.dll, qicod4.dll, QtSvgd4.dll, etc.)

Niels Dekker - no return address noreply at this.is.invalid
Wed Aug 19 15:14:54 CEST 2009


>> QFileIconProvider loads some DLL files that aren't unloaded anymore.
...
>>  'Foo.exe': Loaded 'C:\Qt\4.5.2\plugins\imageformats\qgifd4.dll'
>>  'Foo.exe': Loaded 'C:\Qt\4.5.2\plugins\imageformats\qicod4.dll'
>>  'Foo.exe': Loaded 'C:\Qt\4.5.2\plugins\imageformats\qjpegd4.dll'
>>  'Foo.exe': Loaded 'C:\Qt\4.5.2\plugins\imageformats\qmngd4.dll'
>>  'Foo.exe': Loaded 'C:\Qt\4.5.2\plugins\imageformats\qsvgd4.dll'
...

Martin Hofius wrote (as well as Tony Rietwyk):
> why is it important for you to unload these dll's?

Basically it's a matter of good programming style. We just don't want to 
leak resources from the user. QFileIconProvider breaks a fundamental C++ 
idiom: RAII 
http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization 
Moreover, it doesn't even offer a way to manually free those resources.

More specifically, our application is based on Microsoft's MFC, and only 
uses a Qt based widget for a short while.  When this widget is closed, 
the Qt specific libraries are no longer needed.

But we have another problem: when using QFileSystemModel (with uses 
QFileIconProvider), our application becomes unstable, on some machines! 
Apparently those are all machines that do not have the imageformat 
plugins (qgifd4.dll,qicod4.dll, etc.). Are those plugins required, in 
order to use QFileSystemModel?  (So far, we only shipped QtGui4.dll, 
QtCore4.dll, and QtXml4.dll with the DLL of our widget.)

Interestingly, on machines that don't have the plugins, QtGui4.dll and 
QtCore4.dll are unloaded properly, when our own Qt based DLL is 
unloaded.

So we have a serious problem here.  Your help is appreciated.

Kind regards, Niels

--
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center 




More information about the Qt-interest-old mailing list