]> git.sesse.net Git - vlc/commitdiff
qt4: fix memory leak (allocate only when needed)
authorRémi Duraffort <ivoire@videolan.org>
Mon, 16 Dec 2013 18:36:49 +0000 (19:36 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Mon, 16 Dec 2013 18:36:49 +0000 (19:36 +0100)
modules/gui/qt4/dialogs/toolbar.cpp

index 34e092471f8da38f3de4fda07178fb4123897c30..141970447ec3bb7ac84585da08e336e032f115c7 100644 (file)
@@ -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 );
 }