]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix reentrancy in wxDataViewRendererBase::FinishEditing().
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 2 Dec 2011 00:50:35 +0000 (00:50 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 2 Dec 2011 00:50:35 +0000 (00:50 +0000)
Switching focus to the main wxDataViewCtrl window resulted in focus loss event
and a reentrant call to FinishEditing() itself if it wasn't called because the
in-place edit control was being destroyed the first time.

Fix this by destroying the in-place control first and adjusting the focus
later, the effect should be exactly the same but now FinishEditing() can be
safely called from anywhere in the code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69896 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/datavcmn.cpp

index ad62ddae046d8a8e7c4bf5e6ef540d2f0585bff7..1dde0aadd153b313137b650f282fa11a8a4bcaec 100644 (file)
@@ -760,10 +760,10 @@ bool wxDataViewRendererBase::FinishEditing()
 
     wxDataViewCtrl* dv_ctrl = GetOwner()->GetOwner();
 
-    dv_ctrl->GetMainWindow()->SetFocus();
-
     DestroyEditControl();
 
+    dv_ctrl->GetMainWindow()->SetFocus();
+
     bool isValid = Validate(value);
     unsigned int col = GetOwner()->GetModelColumn();