Skip to content

Commit

Permalink
Version check wxWidgets workaround in TreeModel::Clear
Browse files Browse the repository at this point in the history
The comment indicates that the ItemsDeleted-before-Clear workaround is needed
for 3.0.5, but on my Ubuntu 20.04 system with 3.0.4, this actually causes an
assertion deep within wxWidgets. The workaround is therefore placed behind a
wxCHECK_VERSION macro to avoid using it on 3.0.4 and earlier.
  • Loading branch information
Matthew Mott committed Dec 10, 2020
1 parent 44b4fbf commit f29d26a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/wxutil/TreeModel.cpp
Expand Up @@ -274,6 +274,7 @@ TreeModel::Row TreeModel::GetRootItem()

void TreeModel::Clear()
{
#if wxCHECK_VERSION(3, 0, 5)
// To work around a problem in wxGTK 3.0.5+, trigger
// an ItemRemoved call for all top-level children before
// actually deleting them.
Expand All @@ -286,6 +287,7 @@ void TreeModel::Clear()
{
ItemsDeleted(_rootNode->item, children);
}
#endif

// Now it should be safe to free all the nodes
_rootNode->values.clear();
Expand Down

0 comments on commit f29d26a

Please sign in to comment.