Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-6909

Global variables not cleared

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.6.0
    • Core: Plugins
    • 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; \
              }
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            dzyubenk Denis Dzyubenko (Inactive)
            bucreev@mail.ru Alex Bukreev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes