summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-05-13 14:11:07 +0100
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-06-02 14:42:04 +0100
commit603ccb3d715b1d6e9969b2df8ab27461f51728fb (patch)
tree9808e8fe4588c461b2033fb20eb1b8a195552113
parent6c57e76ea755b28d30405fd1239bf4275e8271b4 (diff)
Window visibility changes update TLW backing store reference count
* When a native window becomes completely invisible, the reference count of the top-level widget's backing store is decremented. * When a previously invisible native window becomes either partially or fully visible: - If the top-level widget has a backing store, its reference count is incremented. - Otherwise, the top-level widget creates a backing store with an initial reference count of 1. Task-number: QTBUG-8697 Reviewed-by: Jason Barron
-rw-r--r--src/gui/kernel/qapplication_s60.cpp23
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp2
2 files changed, 17 insertions, 8 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 6997326bdd..78027b2752 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1703,18 +1703,27 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent
return 1;
const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged();
QWidget *w = QWidgetPrivate::mapper->value(control);
- if (!w->d_func()->maybeTopData())
+ QWidget *const window = w->window();
+ if (!window->d_func()->maybeTopData())
break;
+ QRefCountedWidgetBackingStore &backingStore = window->d_func()->maybeTopData()->backingStore;
if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) {
- w->d_func()->topData()->backingStore.destroy();
+ // Decrement backing store reference count
+ backingStore.deref();
// In order to ensure that any resources used by the window surface
// are immediately freed, we flush the WSERV command buffer.
S60->wsSession().Flush();
- } else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible)
- && !w->d_func()->maybeBackingStore()) {
- w->d_func()->topData()->backingStore.create(w);
- w->d_func()->invalidateBuffer(w->rect());
- w->repaint();
+ } else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) {
+ if (backingStore.data()) {
+ // Increment backing store reference count
+ backingStore.ref();
+ } else {
+ // Create backing store with an initial reference count of 1
+ backingStore.create(window);
+ backingStore.ref();
+ w->d_func()->invalidateBuffer(w->rect());
+ w->repaint();
+ }
}
return 1;
}
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 9369f4a774..7d4f8ffa1a 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -9635,7 +9635,6 @@ void tst_QWidget::destroyBackingStoreWhenHidden()
// Backing store should remain unchanged despite child window obscuring
// parent window
- QEXPECT_FAIL("", "QTBUG-8697", Continue);
QVERIFY(parentBs == backingStore(parent));
QVERIFY(0 == backingStore(child));
}
@@ -9742,6 +9741,7 @@ void tst_QWidget::destroyBackingStoreWhenHidden()
QVERIFY(0 != backingStore(child));
// Parent is obscured, therefore its backing store should be destroyed
+ QEXPECT_FAIL("", "QTBUG-10643", Continue);
QVERIFY(0 == backingStore(parent));
// Disable full screen