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
parent 11a5b83e2c
commit 44dc3e20df

View File

@@ -1072,8 +1072,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,
@@ -1083,16 +1095,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 )