diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/outdev/outdev.cxx | 19 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 17 |
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() |