summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmainwindowlayout.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-08 11:18:24 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-08 11:18:24 (GMT)
commit191c621cbaa318e60111ae88c7b1e57286b1368b (patch)
treecf714c377a5032c8d1d2e579d35d31b28a29eb3f /src/gui/widgets/qmainwindowlayout.cpp
parent7486389a0d742a7c9e70c6110692186f70dbf1e5 (diff)
downloadQt-191c621cbaa318e60111ae88c7b1e57286b1368b.zip
Qt-191c621cbaa318e60111ae88c7b1e57286b1368b.tar.gz
Qt-191c621cbaa318e60111ae88c7b1e57286b1368b.tar.bz2
QMainWindow: fixed a crash in some cases when deleting the widget
This happened because the rubberband used as a gapindicator was not allocated on the heap and might have been deleted by the QMainWindow destructor. Task-number: 257626
Diffstat (limited to 'src/gui/widgets/qmainwindowlayout.cpp')
-rw-r--r--src/gui/widgets/qmainwindowlayout.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp
index a02dca3..ad608d3 100644
--- a/src/gui/widgets/qmainwindowlayout.cpp
+++ b/src/gui/widgets/qmainwindowlayout.cpp
@@ -1639,7 +1639,7 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow)
, widgetAnimator(this)
, pluggingWidget(0)
#ifndef QT_NO_RUBBERBAND
- , gapIndicator(QRubberBand::Rectangle, mainwindow)
+ , gapIndicator(new QRubberBand(QRubberBand::Rectangle, mainwindow))
#endif //QT_NO_RUBBERBAND
{
#ifndef QT_NO_DOCKWIDGET
@@ -1655,8 +1655,8 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow)
#ifndef QT_NO_RUBBERBAND
// For accessibility to identify this special widget.
- gapIndicator.setObjectName(QLatin1String("qt_rubberband"));
- gapIndicator.hide();
+ gapIndicator->setObjectName(QLatin1String("qt_rubberband"));
+ gapIndicator->hide();
#endif
pluggingWidget = 0;
@@ -1762,14 +1762,8 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget)
void QMainWindowLayout::updateGapIndicator()
{
#ifndef QT_NO_RUBBERBAND
- if (widgetAnimator.animating() || currentGapPos.isEmpty()) {
- gapIndicator.hide();
- } else {
- if (gapIndicator.geometry() != currentGapRect)
- gapIndicator.setGeometry(currentGapRect);
- if (!gapIndicator.isVisible())
- gapIndicator.show();
- }
+ gapIndicator->setVisible(!widgetAnimator.animating() && !currentGapPos.isEmpty());
+ gapIndicator->setGeometry(currentGapRect);
#endif
}