diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-05-13 13:11:07 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-06-02 13:42:04 (GMT) |
commit | 603ccb3d715b1d6e9969b2df8ab27461f51728fb (patch) | |
tree | 9808e8fe4588c461b2033fb20eb1b8a195552113 /src/gui/kernel/qapplication_s60.cpp | |
parent | 6c57e76ea755b28d30405fd1239bf4275e8271b4 (diff) | |
download | Qt-603ccb3d715b1d6e9969b2df8ab27461f51728fb.zip Qt-603ccb3d715b1d6e9969b2df8ab27461f51728fb.tar.gz Qt-603ccb3d715b1d6e9969b2df8ab27461f51728fb.tar.bz2 |
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
Diffstat (limited to 'src/gui/kernel/qapplication_s60.cpp')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6997326..78027b2 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; } |