Skip to content

Commit

Permalink
qt4: fix memory leak (allocate only when needed)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivoire committed Dec 16, 2013
1 parent d052232 commit d6aa5c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/gui/qt4/dialogs/toolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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 );
}

Expand Down

0 comments on commit d6aa5c4

Please sign in to comment.