vclwidget: add some dispose() checking
to catch code that accidentally recursively calls dispose()
Change-Id: I647434c76cfbbf4df32c6cef15381ecfd8b4977d
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 31c5dff..78d3321 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 17b3cea..60443ff 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;