Index: lisp/wid-edit.el =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/lisp/wid-edit.el,v retrieving revision 1.11.2.8 diff -u -r1.11.2.8 wid-edit.el --- lisp/wid-edit.el 1999/11/27 05:27:30 1.11.2.8 +++ lisp/wid-edit.el 1999/12/28 12:05:02 @@ -1898,9 +1898,6 @@ :group 'widgets :type 'boolean) -;; Cache already created GUI objects. -(defvar widget-push-button-cache nil) - (defcustom widget-push-button-prefix "[" "String used as prefix for buttons." :type 'string @@ -1925,7 +1922,7 @@ (tag-glyph (widget-get widget :tag-glyph)) (text (concat widget-push-button-prefix tag widget-push-button-suffix)) - (gui-glyphs (lax-plist-get widget-push-button-cache tag))) + gui) (cond (tag-glyph (widget-glyph-insert widget text tag-glyph)) ;; We must check for console-on-window-system-p here, @@ -1933,13 +1930,10 @@ ;; components for colors, and they are not known on TTYs). ((and widget-push-button-gui (console-on-window-system-p)) - (unless gui-glyphs - (let* ((gui-button-shadow-thickness 1) - (gui (make-glyph - (make-gui-button tag 'widget-gui-action widget)))) - (setq gui-glyphs gui) - (laxputf widget-push-button-cache tag gui-glyphs))) - (widget-glyph-insert-glyph widget gui-glyphs)) + (let* ((gui-button-shadow-thickness 1)) + (setq gui (make-glyph + (make-gui-button tag 'widget-gui-action widget)))) + (widget-glyph-insert-glyph widget gui)) (t (insert text))))) Index: src/gui-x.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/gui-x.c,v retrieving revision 1.14.2.13 diff -u -r1.14.2.13 gui-x.c --- src/gui-x.c 1999/10/24 03:48:41 1.14.2.13 +++ src/gui-x.c 1999/12/28 12:05:07 @@ -143,7 +143,7 @@ widget_value *wv = (widget_value *) get_opaque_ptr (closure); free_opaque_ptr (closure); if (wv) - free_widget_value (wv); + free_widget_value_tree (wv); return Qnil; } @@ -186,6 +186,7 @@ if (! wv) return; if (wv->key) xfree (wv->key); if (wv->value) xfree (wv->value); + if (wv->name) xfree (wv->name); wv->name = wv->value = wv->key = (char *) 0xDEADBEEF; @@ -469,7 +470,7 @@ prev->next = wv; if (!button_item_to_widget_value (items, wv, 0, 1)) { - free_widget_value (wv); + free_widget_value_tree (wv); if (parent) parent->contents = 0; else @@ -546,7 +547,7 @@ control = control->contents; tmp->next = 0; tmp->contents = 0; - free_widget_value (tmp); + free_widget_value_tree (tmp); /* No more need to free the half-filled-in structures. */ set_opaque_ptr (wv_closure, 0); Index: src/dialog-x.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/dialog-x.c,v retrieving revision 1.6.2.2 diff -u -r1.6.2.2 dialog-x.c --- src/dialog-x.c 1999/06/25 14:16:45 1.6.2.2 +++ src/dialog-x.c 1999/12/28 12:05:12 @@ -44,7 +44,7 @@ widget_value *wv; int got_some; wv = xmalloc_widget_value (); - wv->name = (char *) "value"; + wv->name = xstrdup ("value"); got_some = lw_get_some_values (id, wv); if (got_some) { @@ -56,10 +56,12 @@ void *tmp = LISP_TO_VOID (list2 (text_field_callback, build_string (text_field_value))); popup_selection_callback (0, id, (XtPointer) tmp); - xfree (text_field_value); } } - free_widget_value (wv); + /* This code tried to optimize, newing/freeing. This is generally + unsafe so we will alwats strdup and always use + free_widget_value_tree. */ + free_widget_value_tree (wv); } static void @@ -144,7 +146,7 @@ wv_closure = make_opaque_ptr (kids); record_unwind_protect (widget_value_unwind, wv_closure); - prev->name = (char *) "message"; + prev->name = xstrdup ("message"); prev->value = xstrdup (name); prev->enabled = 1; @@ -166,7 +168,7 @@ gui_item = gui_parse_item_keywords (button); if (!button_item_to_widget_value (gui_item, wv, allow_text_p, 1)) { - free_widget_value (wv); + free_widget_value_tree (wv); continue; } @@ -178,8 +180,9 @@ else /* it's a button */ { allow_text_p = 0; /* only allow text field at the front */ - wv->value = xstrdup (wv->name); /* what a mess... */ - wv->name = (char *) button_names [n]; + if (wv->value) xfree (wv->value); + wv->value = wv->name; /* what a mess... */ + wv->name = xstrdup (button_names [n]); if (partition_seen) rbuttons++; @@ -202,7 +205,7 @@ widget_value *dbox; sprintf (tmp_dbox_name, "%c%dBR%d", type, lbuttons + rbuttons, rbuttons); dbox = xmalloc_widget_value (); - dbox->name = tmp_dbox_name; + dbox->name = xstrdup (tmp_dbox_name); dbox->contents = kids; /* No more need to free the half-filled-in structures. */ Index: src/scrollbar-x.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/scrollbar-x.c,v retrieving revision 1.14.2.4 diff -u -r1.14.2.4 scrollbar-x.c --- src/scrollbar-x.c 1999/10/10 12:40:15 1.14.2.4 +++ src/scrollbar-x.c 1999/12/28 12:05:13 @@ -215,6 +215,7 @@ wv->scrollbar_data = xnew (scrollbar_values); wv->name = SCROLLBAR_X_NAME (instance); + wv->name = xstrdup (wv->name); wv->value = 0; wv->key = 0; wv->enabled = instance->scrollbar_is_active; @@ -278,9 +279,7 @@ } if (!wv->scrollbar_data) abort (); - xfree (wv->scrollbar_data); - wv->scrollbar_data = 0; - free_widget_value (wv); + free_widget_value_tree (wv); } else if (managed) { Index: src/menubar-x.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/menubar-x.c,v retrieving revision 1.18.2.9 diff -u -r1.18.2.9 menubar-x.c --- src/menubar-x.c 1999/10/10 12:40:12 1.18.2.9 +++ src/menubar-x.c 1999/12/28 12:05:16 @@ -120,7 +120,7 @@ } else { - wv->name = string_chars; + wv->name = xstrdup (string_chars); wv->enabled = 1; /* dverna Dec. 98: command_builder_operate_menu_accelerator will manipulate the accel as a Lisp_Object if the widget has a name. @@ -157,6 +157,7 @@ wv->type = CASCADE_TYPE; wv->enabled = 1; wv->name = (char *) XSTRING_DATA (LISP_GETTEXT (XCAR (desc))); + wv->name = xstrdup (wv->name); accel = gui_name_accelerator (LISP_GETTEXT (XCAR (desc))); wv->accel = LISP_TO_VOID (accel); @@ -226,6 +227,7 @@ incr_wv->type = INCREMENTAL_TYPE; incr_wv->enabled = 1; incr_wv->name = wv->name; + incr_wv->name = xstrdup (wv->name); /* This is automatically GC protected through the call to lw_map_widget_values(); no need to worry. */ @@ -242,7 +244,7 @@ widget_value *title_wv = xmalloc_widget_value (); widget_value *sep_wv = xmalloc_widget_value (); title_wv->type = TEXT_TYPE; - title_wv->name = wv->name; + title_wv->name = xstrdup (wv->name); title_wv->enabled = 1; title_wv->next = sep_wv; sep_wv->type = SEPARATOR_TYPE; @@ -258,7 +260,7 @@ widget_value *dummy; /* Add a fake entry so the menus show up */ wv->contents = dummy = xmalloc_widget_value (); - dummy->name = "(inactive)"; + dummy->name = xstrdup ("(inactive)"); dummy->accel = LISP_TO_VOID (Qnil); dummy->enabled = 0; dummy->selected = 0; @@ -273,7 +275,7 @@ } else if (menubar_root_p) { - wv->name = (char *) "menubar"; + wv->name = xstrdup ("menubar"); wv->type = CASCADE_TYPE; /* Well, nothing else seems to fit and this is ignored anyway... */ } @@ -469,7 +471,7 @@ wv->accel = LISP_TO_VOID (Qnil); wv->contents = xmalloc_widget_value (); wv->contents->type = TEXT_TYPE; - wv->contents->name = (char *) "No menu"; + wv->contents->name = xstrdup ("No menu"); wv->contents->next = NULL; wv->contents->accel = LISP_TO_VOID (Qnil); } Index: src/redisplay-output.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/redisplay-output.c,v retrieving revision 1.11.2.21 diff -u -r1.11.2.21 redisplay-output.c --- src/redisplay-output.c 1999/12/05 21:51:40 1.11.2.21 +++ src/redisplay-output.c 1999/12/28 12:05:19 @@ -1729,23 +1729,27 @@ int right = WINDOW_TEXT_RIGHT (w); int top = WINDOW_TEXT_TOP (w); int bottom = WINDOW_TEXT_BOTTOM (w); + int ret = -1; if (db->xpos < left || db->ypos < top || db->xpos + db->width > right || db->ypos + db->height > bottom) - /* We are not displaying in a window at all */ - return 0; - - if (db->xpos + dga->xoffset >= left - && - db->ypos + dga->yoffset >= top - && - db->xpos + dga->xoffset + dga->width <= right - && - db->ypos + dga->yoffset + dga->height <= bottom) - return 1; + { + /* We are not displaying in a window at all */ + ret = 0; + } + else if (db->xpos + dga->xoffset >= left + && + db->ypos + dga->yoffset >= top + && + db->xpos + dga->xoffset + dga->width <= right + && + db->ypos + dga->yoffset + dga->height <= bottom) + { + ret = 1; + } - return -1; + return ret; } /*****************************************************************************