[vlc-commits] qt4: fix memory leak (allocate only when needed)

Rémi Duraffort git at videolan.org
Mon Dec 16 19:54:49 CET 2013


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Dec 16 19:36:49 2013 +0100| [d6aa5c4b19185c3eed5bccba708b9b42d2c995ca] | committer: Rémi Duraffort

qt4: fix memory leak (allocate only when needed)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d6aa5c4b19185c3eed5bccba708b9b42d2c995ca
---

 modules/gui/qt4/dialogs/toolbar.cpp |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt4/dialogs/toolbar.cpp b/modules/gui/qt4/dialogs/toolbar.cpp
index 34e0924..1419704 100644
--- a/modules/gui/qt4/dialogs/toolbar.cpp
+++ b/modules/gui/qt4/dialogs/toolbar.cpp
@@ -555,10 +555,6 @@ void DroppingController::createAndAddWidget( QBoxLayout *newControlLayout,
                                              buttonType_e i_type,
                                              int i_option )
 {
-    doubleInt *value = new doubleInt;
-    value->i_type = i_type;
-    value->i_option = i_option;
-
     /* Special case for SPACERS, who aren't QWidgets */
     if( i_type == WIDGET_SPACER || i_type == WIDGET_SPACER_EXTEND )
     {
@@ -628,6 +624,10 @@ void DroppingController::createAndAddWidget( QBoxLayout *newControlLayout,
     /* QList and QBoxLayout don't act the same with insert() */
     if( i_index < 0 ) i_index = newControlLayout->count() - 1;
 
+    doubleInt *value = new doubleInt;
+    value->i_type = i_type;
+    value->i_option = i_option;
+
     widgetList.insert( i_index, value );
 }
 



More information about the vlc-commits mailing list