From 4cecd707cd0149acf2b9cdbcb945a006e1d20a10 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 1 Dec 2003 05:56:30 +0000
Subject: [PATCH] Fix rare crash due to Fl_Widget::tooltip() not actually
 copying the string.

---
 Common/Options.cpp | 13 +++++--------
 Fltk/GUI.cpp       |  5 ++++-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Common/Options.cpp b/Common/Options.cpp
index dffa891cdd..5d96af3a19 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.121 2003-11-29 01:38:49 geuzaine Exp $
+// $Id: Options.cpp,v 1.122 2003-12-01 05:56:30 geuzaine Exp $
 //
 // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
 //
@@ -1599,6 +1599,10 @@ char *opt_view_name(OPT_ARGS_STR)
     strcpy(v->Name, val);
 #if defined(HAVE_FLTK)
     if(WID && num < NB_BUTT_MAX) {
+      // this is OK even if v->Name is not static or allocated, since
+      // we reset it correctly in the main GUI routines when the view
+      // associated with the button changes (i.e., when views are
+      // removed)
       WID->m_toggle_butt[num]->label(v->Name);
       WID->m_toggle_butt[num]->redraw();
     }
@@ -1630,13 +1634,6 @@ char *opt_view_filename(OPT_ARGS_STR)
   GET_VIEW(NULL);
   if(action & GMSH_SET) {
     strcpy(v->FileName, val);
-#if defined(HAVE_FLTK)
-#if !((FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 0))
-    if(WID && num < NB_BUTT_MAX) {
-      WID->m_toggle_butt[num]->tooltip(v->FileName);
-    }
-#endif
-#endif
   }
   return v->FileName;
 }
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index a525bd4e33..16dd508138 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.255 2003-11-29 01:38:49 geuzaine Exp $
+// $Id: GUI.cpp,v 1.256 2003-12-01 05:56:30 geuzaine Exp $
 //
 // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
 //
@@ -980,6 +980,9 @@ void GUI::set_context(Context_Item * menu_asked, int flag)
       m_toggle_butt[i]->show();
       m_toggle_butt[i]->value(v->Visible);
       m_toggle_butt[i]->label(v->Name);
+#if !((FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 0))
+      m_toggle_butt[i]->tooltip(v->FileName);
+#endif
       m_toggle2_butt[i]->show();
       m_popup_butt[i]->show();
       m_popup2_butt[i]->show();
-- 
GitLab