Fix of a Linux / GTK specific crash on deleting of Layers from the side panel: wxWidgets / GTK internally delays the EnsureVisible() call to Idle processing. If the item is deleted after EnsureVisible() is planned and before the Idle processed, the Idle processing routine works with deleted data
This commit is contained in:
parent
4dd9817176
commit
d36c64873d
1 changed files with 13 additions and 2 deletions
|
@ -186,7 +186,18 @@ ObjectList::ObjectList(wxWindow* parent) :
|
|||
|
||||
Bind(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, [this](wxCommandEvent& e) { last_volume_is_deleted(e.GetInt()); });
|
||||
|
||||
Bind(wxEVT_SIZE, ([this](wxSizeEvent &e) { this->EnsureVisible(this->GetCurrentItem()); e.Skip(); }));
|
||||
Bind(wxEVT_SIZE, ([this](wxSizeEvent &e) {
|
||||
#ifdef __WXGTK__
|
||||
// On GTK, the EnsureVisible call is postponed to Idle processing (see wxDataViewCtrl::m_ensureVisibleDefered).
|
||||
// So the postponed EnsureVisible() call is planned for an item, which may not exist at the Idle processing time, if this wxEVT_SIZE
|
||||
// event is succeeded by a delete of the currently active item. We are trying our luck by postponing the wxEVT_SIZE triggered EnsureVisible(),
|
||||
// which seems to be working as of now.
|
||||
this->CallAfter([this](){ this->EnsureVisible(this->GetCurrentItem()); });
|
||||
#else
|
||||
this->EnsureVisible(this->GetCurrentItem());
|
||||
#endif
|
||||
e.Skip();
|
||||
}));
|
||||
}
|
||||
|
||||
ObjectList::~ObjectList()
|
||||
|
|
Loading…
Reference in a new issue