Fix crash in docview code if view initialization failed.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Jul 2013 15:26:36 +0000 (15:26 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Jul 2013 15:26:36 +0000 (15:26 +0000)
commita68a361276d925b58e574e7d0e5a45f0108d82b4
treed0c06d0a807cc5ac813b8c8b38904d3ef867e199
parente9af1bf1b3474868a8a79b4b112d9383080ea3fd
Fix crash in docview code if view initialization failed.

The change of r71371 resulted in using the already destroyed (implicitly, done
as part of destroying the wxView that failed to initialize) wxDocument in
wxScopeGuard destructor.

Avoid this and make the old (i.e. pre-r71371) code exception safe while
keeping its semantics exactly, i.e. only delete all views if the document
still exists.

Also add a comment explaining what's going on here because the ownership rules
in docview code are frankly crazy.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
src/common/docview.cpp