Fix stale current_ pointer when deleting Fl_Group

If a user program accidentally deletes the "current" group, then
the pointer would still point at the deleted widget. This commit
prevents this and makes the Fl_Group's parent the current group.

Fixes issue #88.
This commit is contained in:
Albrecht Schlosser 2020-06-15 01:38:18 +02:00
parent b8318480f5
commit a7a1e1594c
1 changed files with 2 additions and 0 deletions

View File

@ -452,6 +452,8 @@ void Fl_Group::clear() {
widgets' destructors would be called twice!
*/
Fl_Group::~Fl_Group() {
if (current_ == this)
end();
clear();
}