- 
    
Suggestion
 - 
    Resolution: Duplicate
 - 
    
  Not Evaluated                     
     - 
    None
 - 
    4.6.0
 - 
    None
 
Task Tracker - Entry
253013 - Global variables not cleared
> At the program termination following global variables are not cleared:
> "p5s", declared in a file "src\corelib\tools\qlocale.cpp" and
> "_instance", declared in a file "src\corelib\plugin\qplugin.h".
>
> I understand that it is not an error, however in similar cases you
> have undertaken essential efforts for cleaning of static variables.
In version 4.6.0 of library "Qt" the global variable "p5s" is cleared, but "_instance" is not cleared. For correction of it I suggest to substitute in a file "src\corelib\plugin\qplugin.h" lines:
#define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \
        { \
            static QT_PREPEND_NAMESPACE(QPointer)<QT_PREPEND_NAMESPACE(QObject)> _instance; \
            if (!_instance)      \
                _instance = new IMPLEMENTATION; \
            return _instance; \
        }
to:
class DeletePoint : public QPointer<QObject> { public: inline ~DeletePoint(){if(data())delete data();} inline DeletePoint &operator=(QObject* p){*(QPointer<QObject>*)this=p;return *this;} }; #define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \ { \ static DeletePoint _instance; \ if (!_instance) \ _instance = new IMPLEMENTATION; \ return _instance; \ }
- is replaced by
 - 
                    
QTBUG-4341 Memoryleak in QLibraryPrivate: No unload for QImageIOPlugins
-         
 - Closed
 
 -