clang-tidy: Avoid potential memory leak in BufferViewManager
[quassel.git] / src / core / corebufferviewmanager.cpp
index 58a1dd4..87a4192 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-09 by the Quassel Project                          *
+ *   Copyright (C) 2005-2018 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -15,7 +15,7 @@
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
 #include "corebufferviewmanager.h"
@@ -37,7 +37,7 @@ CoreBufferViewManager::CoreBufferViewManager(SignalProxy *proxy, CoreSession *pa
     while (iter != iterEnd) {
         config = new CoreBufferViewConfig(iter.key().toInt(), iter.value().toMap(), this);
         addBufferViewConfig(config);
-        iter++;
+        ++iter;
     }
 }
 
@@ -50,7 +50,7 @@ void CoreBufferViewManager::saveBufferViews()
     BufferViewConfigHash::const_iterator iterEnd = bufferViewConfigHash().constEnd();
     while (iter != iterEnd) {
         views[QString::number((*iter)->bufferViewId())] = (*iter)->toVariantMap();
-        iter++;
+        ++iter;
     }
 
     Core::setUserSetting(_coreSession->user(), "BufferViews", views);
@@ -70,12 +70,11 @@ void CoreBufferViewManager::requestCreateBufferView(const QVariantMap &propertie
         if ((*iter)->bufferViewId() > maxId)
             maxId = (*iter)->bufferViewId();
 
-        iter++;
+        ++iter;
     }
     maxId++;
 
-    CoreBufferViewConfig *config = new CoreBufferViewConfig(maxId, properties);
-    addBufferViewConfig(config);
+    addBufferViewConfig(new CoreBufferViewConfig(maxId, properties, this));
 }
 
 
@@ -85,7 +84,7 @@ void CoreBufferViewManager::requestCreateBufferViews(const QVariantList &propert
     QVariantList::const_iterator iterEnd = properties.constEnd();
     while (iter != iterEnd) {
         requestCreateBufferView((*iter).toMap());
-        iter++;
+        ++iter;
     }
 }