diff options
author | Noel Grandin <noel@peralex.com> | 2015-02-12 09:38:37 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-09 22:18:28 +0100 |
commit | f7811b53c95410b8f1aa65b93b65701fd427a64f (patch) | |
tree | c25873cc991f85565107b6a5d12b106245361142 | |
parent | 00f2787a4a68633206635743298926bf2e65a8fa (diff) |
vclwidget: add some dispose() checking
to catch code that accidentally recursively calls dispose()
Change-Id: I647434c76cfbbf4df32c6cef15381ecfd8b4977d
-rw-r--r-- | vcl/inc/window.h | 1 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 31c5dff7f4ea..78d3321ec4c2 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -355,6 +355,7 @@ public: mbPaintDisabled:1, mbAllResize:1, mbInDtor:1, + mbInDispose:1, mbExtTextInput:1, mbInFocusHdl:1, mbOverlapVisible:1, diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 17b3ceab693d..60443fff15e7 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -136,6 +136,12 @@ void Window::dispose() if (!mpWindowImpl) return; + // TODO: turn this assert on once we have switched to using VclPtr everywhere + //assert( !mpWindowImpl->mbInDispose && "vcl::Window - already in dispose()" ); + if (mpWindowImpl->mbInDispose) + return; + mpWindowImpl->mbInDispose = true; + // remove Key and Mouse events issued by Application::PostKey/MouseEvent Application::RemoveMouseAndKeyEvents( this ); @@ -711,6 +717,7 @@ WindowImpl::WindowImpl( WindowType nType ) mbPaintDisabled = false; // true: Paint should not be executed mbAllResize = false; // true: Also sent ResizeEvents with 0,0 mbInDtor = false; // true: We're still in Window-Dtor + mbInDispose = false; // true: We're still in Window::dispose() mbExtTextInput = false; // true: ExtTextInput-Mode is active mbInFocusHdl = false; // true: Within GetFocus-Handler mbCreatedWithToolkit = false; |