From 0091d4d4d68cc181df12e1e9d7fff31bf82bc68e Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 31 Jul 2001 22:20:05 +0000 Subject: [PATCH] Fix seg fault if loading more that NB_BUTT_MAX views --- Common/Options.cpp | 6 +++--- examples/500views.geo | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 examples/500views.geo diff --git a/Common/Options.cpp b/Common/Options.cpp index e28292224e..c11ef940cb 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.35 2001-07-30 20:22:55 geuzaine Exp $ +// $Id: Options.cpp,v 1.36 2001-07-31 22:20:05 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -507,7 +507,7 @@ char * opt_view_name(OPT_ARGS_STR){ if(action & GMSH_SET){ strcpy(v->Name, val); #ifdef _FLTK - if(WID){ + if(WID && num<NB_BUTT_MAX){ WID->m_toggle_butt[num]->label(v->Name); WID->m_toggle_butt[num]->redraw(); } @@ -1708,7 +1708,7 @@ double opt_view_visible(OPT_ARGS_NUM){ v->Visible = (int)val; } #ifdef _FLTK - if(WID && (action & GMSH_GUI)) + if(WID && (action & GMSH_GUI) && num<NB_BUTT_MAX) WID->m_toggle_butt[num]->value(v->Visible); #endif Msg(DEBUG1, "View %d", v->Num); diff --git a/examples/500views.geo b/examples/500views.geo new file mode 100644 index 0000000000..e076db3b97 --- /dev/null +++ b/examples/500views.geo @@ -0,0 +1,10 @@ + +// this tests that we can still load as many views as we want. +// (even if only 200 are allowed in the GUI) + +For i In {0:250} + +Include "../tutorial/view1.pos" ; +Include "../tutorial/view2.pos" ; + +EndFor -- GitLab