From: Jean-Baptiste Kempf Date: Fri, 24 Jul 2009 10:15:13 +0000 (+0200) Subject: Qt: fix crash in customize toolbar dialog. X-Git-Tag: 1.1.0-ff~4827 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=afba44402d6ef8208b2d9f9d88d55053555c5a34;p=vlc Qt: fix crash in customize toolbar dialog. For some reasons, this doesn't crash on Linux... (cherry picked from commit 25d37a4930519c5bcabbe2c0fae8c86e38d9ea54) Signed-off-by: Jean-Baptiste Kempf --- diff --git a/modules/gui/qt4/dialogs/toolbar.cpp b/modules/gui/qt4/dialogs/toolbar.cpp index 68e501e850..f57b8f7c60 100644 --- a/modules/gui/qt4/dialogs/toolbar.cpp +++ b/modules/gui/qt4/dialogs/toolbar.cpp @@ -647,16 +647,14 @@ inline int DroppingController::getParentPosInLayout( QPoint point ) QPoint origin = mapToGlobal ( point ); QWidget *tempWidg = QApplication::widgetAt( origin ); + if( tempWidg == NULL ) + return -1; - int i = -1; - if( tempWidg != NULL) + int i = controlLayout->indexOf( tempWidg ); + if( i == -1 ) { - i = controlLayout->indexOf( tempWidg ); - if( i == -1 ) - { - i = controlLayout->indexOf( tempWidg->parentWidget() ); - tempWidg = tempWidg->parentWidget(); - } + i = controlLayout->indexOf( tempWidg->parentWidget() ); + tempWidg = tempWidg->parentWidget(); } /* Return the nearest position */