From a7a1e1594c7c574b135a99f80edbf47a7352e974 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 15 Jun 2020 01:38:18 +0200 Subject: [PATCH] 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. --- src/Fl_Group.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx index aefead997..2ec83d493 100644 --- a/src/Fl_Group.cxx +++ b/src/Fl_Group.cxx @@ -452,6 +452,8 @@ void Fl_Group::clear() { widgets' destructors would be called twice! */ Fl_Group::~Fl_Group() { + if (current_ == this) + end(); clear(); }