summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-03-14 22:16:11 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-04-10 11:03:10 +0100
commitbc139dde60a25a7ccb60446c7cb8475ab794bfdc (patch)
treef1107a965bc332f73d23e5fb650cb3e3421e0117 /vcl
parent06f4760e3451601b3f43a72c4f1c5c4233c3f61a (diff)
vclptr: move down impl. to OutputDevice
Ultimately we will want to ref-count & VclPtr OutputDevice instances separately from Window - but for now merge. This helps fix the amazing lifecycle foo in toolkit/ Change-Id: If40ee9f645c87aff08815926205e908205bdd67a
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/outdev/outdev.cxx19
-rw-r--r--vcl/source/window/window.cxx17
2 files changed, 22 insertions, 14 deletions
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 372eb23bc8f4..5d59ee104029 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -183,7 +183,26 @@ OutputDevice::OutputDevice() :
OutputDevice::~OutputDevice()
{
+ disposeOnce();
+}
+
+void OutputDevice::disposeOnce()
+{
+ if ( mbDisposed )
+ return;
+ mbDisposed = true;
+ // catch badness where our OutputDevice sub-class was not
+ // wrapped safely in a VclPtr cosily.
+ assert( mnRefCnt > 0 );
+
+ // hold a ref in case something unusual happens during dispose.
+ VclPtr<OutputDevice> aRef(this);
+ dispose();
+}
+
+void OutputDevice::dispose()
+{
if ( GetUnoGraphicsList() )
{
UnoWrapperBase* pWrapper = Application::GetUnoWrapper( false );
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index d2177e44ce34..31f537c285d3 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -137,23 +137,10 @@ bool Window::IsDisposed() const
return !mpWindowImpl;
}
-void Window::disposeOnce()
+void Window::dispose()
{
- if (!mpWindowImpl || mpWindowImpl->mbInDispose)
- return;
mpWindowImpl->mbInDispose = true;
- // catch badness where our Window was not wrapped safely
- // in a VclPtr cosily.
- assert( mnRefCnt>0 );
-
- // hold a ref in case something silly happens during dispose.
- VclPtr<Window> aRef(this);
- dispose();
-}
-
-void Window::dispose()
-{
assert( mpWindowImpl && mpWindowImpl->mbInDispose ); // should only be called from disposeOnce()
assert( !mpWindowImpl->mpParent ||
!mpWindowImpl->mpParent->IsDisposed() ||
@@ -585,6 +572,8 @@ void Window::dispose()
// should be the last statements
delete mpWindowImpl; mpWindowImpl = NULL;
+
+ OutputDevice::dispose();
}
Window::~Window()