summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-08 13:18:24 +0200
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-08 13:18:24 +0200
commit191c621cbaa318e60111ae88c7b1e57286b1368b (patch)
treecf714c377a5032c8d1d2e579d35d31b28a29eb3f /src
parent7486389a0d742a7c9e70c6110692186f70dbf1e5 (diff)
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')
-rw-r--r--src/gui/widgets/qmainwindowlayout.cpp16
-rw-r--r--src/gui/widgets/qmainwindowlayout_p.h3
2 files changed, 6 insertions, 13 deletions
diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp
index a02dca3a1b..ad608d3127 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
}
diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h
index a7f70b45b9..45f62cd437 100644
--- a/src/gui/widgets/qmainwindowlayout_p.h
+++ b/src/gui/widgets/qmainwindowlayout_p.h
@@ -59,7 +59,6 @@
#include "QtGui/qlayout.h"
#include "QtGui/qtabbar.h"
-#include "QtGui/qrubberband.h"
#include "QtCore/qvector.h"
#include "QtCore/qset.h"
#include "QtCore/qbasictimer.h"
@@ -284,7 +283,7 @@ public:
QRect currentGapRect;
QWidget *pluggingWidget;
#ifndef QT_NO_RUBBERBAND
- QRubberBand gapIndicator;
+ QRubberBand *gapIndicator;
#endif
QList<int> hover(QLayoutItem *widgetItem, const QPoint &mousePos);