Prevent sending wxEVT_PG_LABEL_EDIT_ENDING events recursively.

By preventing sending wxEVT_PG_LABEL_EDIT_ENDING events recursively (recursive generation can happen due to the calling wxPropertyGrid::RefreshProperty() directly or indirectly from within wxEVT_PG_LABEL_EDIT_ENDING event handler) spurious events are not sent to the application and wxPropertyGrid::DoEndLabelEdit() function is not reentered.

Closes #16864.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Artur Wieczorek
2015-02-15 22:21:56 +00:00
committed by Vadim Zeitlin
parent 1a9900a813
commit 3dcdbe82b3

View File

@@ -1043,8 +1043,20 @@ void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags )
if ( commit )
{
const int labelColIdx = m_selColumn;
if ( !(selFlags & wxPG_SEL_DONT_SEND_EVENT) )
{
// Don't send wxEVT_PG_LABEL_EDIT_ENDING event recursively
// for the same property and the same label.
if ( m_processedEvent &&
m_processedEvent->GetEventType() == wxEVT_PG_LABEL_EDIT_ENDING &&
m_processedEvent->GetProperty() == prop &&
m_processedEvent->GetColumn() == m_selColumn)
{
return;
}
// wxPG_SEL_NOVALIDATE is passed correctly in selFlags
if ( SendEvent( wxEVT_PG_LABEL_EDIT_ENDING,
prop, NULL, selFlags,
@@ -1054,16 +1066,16 @@ void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags )
wxString text = m_labelEditor->GetValue();
wxPGCell* cell = NULL;
if ( prop->HasCell(m_selColumn) )
if ( prop->HasCell(labelColIdx) )
{
cell = &prop->GetCell(m_selColumn);
cell = &prop->GetCell(labelColIdx);
}
else
{
if ( m_selColumn == 0 )
if ( labelColIdx == 0 )
prop->SetLabel(text);
else
cell = &prop->GetOrCreateCell(m_selColumn);
cell = &prop->GetOrCreateCell(labelColIdx);
}
if ( cell )