It seems that it is not safe to remove the item from std::list while it's being iterated somewhere else. This is a very simple quick fix to make things work until some better solution is implemented.
Use std::list instead of GList.