diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx
index aefead99704499bda2272e29fdd584df1b94961f..2ec83d493ad76254a88ec2ff34bec5b4c1fc8897 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();
 }