From 45e3ad86b03205a37045f1bbd0c8cd1774b3c690 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 16 Sep 2004 22:24:48 +0000
Subject: [PATCH] plug memory leak

---
 Fltk/GUI.cpp | 8 ++++++--
 Fltk/GUI.h   | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index b6d3045570..e523702b0b 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.342 2004-09-16 19:15:27 geuzaine Exp $
+// $Id: GUI.cpp,v 1.343 2004-09-16 22:24:48 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -823,9 +823,10 @@ void GUI::add_post_plugins(Fl_Menu_Button * button, int iView)
     GMSH_Plugin *p = (*it).second;
     if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN) {
       p->getName(name);
-      std::pair < int, GMSH_Plugin * >*pair = new std::pair < int, GMSH_Plugin * >(iView, p);
+      std::pair<int, GMSH_Plugin*> *pair = new std::pair < int, GMSH_Plugin * >(iView, p);
       sprintf(menuname, "Plugins/%s...", name);
       button->add(menuname, 0, (Fl_Callback *) view_options_plugin_cb, (void *)(pair), 0);
+      m_pop_plugin.push_back(pair);
       p->dialogBox = 0;
     }
   }
@@ -1002,6 +1003,9 @@ void GUI::set_context(Context_Item * menu_asked, int flag)
   for(unsigned int i = 0; i < m_pop_label.size(); i++)
     delete [] m_pop_label[i];
   m_pop_label.clear();
+  for(unsigned int i = 0; i < m_pop_plugin.size(); i++)
+    delete m_pop_plugin[i];
+  m_pop_plugin.clear();
 
   int width = m_window->w();
   int right_pop_width = 4 * fontsize + 3;
diff --git a/Fltk/GUI.h b/Fltk/GUI.h
index 8a6c13e1f2..e1adce3906 100644
--- a/Fltk/GUI.h
+++ b/Fltk/GUI.h
@@ -143,6 +143,7 @@ public:
   std::vector<Fl_Menu_Button*>  m_popup_butt ;
   std::vector<Fl_Menu_Button*>  m_popup2_butt ;
   std::vector<char*>            m_pop_label ;
+  std::vector<std::pair<int, GMSH_Plugin*>*> m_pop_plugin;
 
   // graphic window
   Fl_Window        *g_window ;
-- 
GitLab