# HG changeset patch # User Gerd Moellmann # Date 932593432 0 # Node ID c69d9e48269b0b2ab5e516fa65b9d9723af82407 # Parent dc975d71a3a578baeff02fe6cca5ee4b0427e068 (make_frame): Set n_current_toolbar_items to 0. (syms_of_frame_1): Add Qtoolbar_lines. (make_frame): Initialize toolbar members. (make_frame): Initialize toolbar_window. (frame-initialize): Set frame-creation-function to tty-create-frame-with-faces. (make_terminal_frame): Call init_frame_faces unconditionally. (make_frame): Call set_window_buffer instead of Fset_window_buffer. (make_frame): Initialze face cache with null. (make_frame): Initialize face_cache. (Fdelete_frame): Free it. (Fdelete_frame): Use xfree instead of free. (set_menu_bar_lines): Ditto. (Fmake_terminal_frame): Ditto. (make_frame): Initialize menu_bar_window to nil. (make_frame): Remove CURSOR_X/Y. (set_menu_bar_lines): Adjust matrices. (make_frame): Initialize pools. (make_frame): initialize DECODE_MODE_SPEC_BUFFER. (Fmake_terminal_frame): Adjust glyphs. (Fdelete_frame): Free glyphs. (make_frame): Initialize matrix fields in frame. diff -r dc975d71a3a5 -r c69d9e48269b src/frame.c --- a/src/frame.c Wed Jul 21 21:43:52 1999 +0000 +++ b/src/frame.c Wed Jul 21 21:43:52 1999 +0000 @@ -84,6 +84,7 @@ Lisp_Object Qonly; Lisp_Object Qunsplittable; Lisp_Object Qmenu_bar_lines; +Lisp_Object Qtoolbar_lines; Lisp_Object Qwidth; Lisp_Object Qx; Lisp_Object Qw32; @@ -120,6 +121,8 @@ staticpro (&Qunsplittable); Qmenu_bar_lines = intern ("menu-bar-lines"); staticpro (&Qmenu_bar_lines); + Qtoolbar_lines = intern ("toolbar-lines"); + staticpro (&Qtoolbar_lines); Qwidth = intern ("width"); staticpro (&Qwidth); Qx = intern ("x"); @@ -200,6 +203,7 @@ FRAME_WINDOW_SIZES_CHANGED (f) = 1; FRAME_MENU_BAR_LINES (f) = nlines; set_menu_bar_lines_1 (f->root_window, nlines - olines); + adjust_glyphs (f); } } @@ -277,10 +281,12 @@ f = (struct frame *)vec; XSETFRAME (frame, f); - f->cursor_x = 0; - f->cursor_y = 0; - f->current_glyphs = 0; - f->desired_glyphs = 0; + f->desired_matrix = 0; + f->current_matrix = 0; + f->desired_pool = 0; + f->current_pool = 0; + f->glyphs_initialized_p = 0; + f->decode_mode_spec_buffer = 0; f->visible = 0; f->async_visible = 0; f->output_data.nothing = 0; @@ -300,6 +306,7 @@ f->scroll_bars = Qnil; f->condemned_scroll_bars = Qnil; f->face_alist = Qnil; + f->face_cache = NULL; f->menu_bar_items = Qnil; f->menu_bar_vector = Qnil; f->menu_bar_items_used = 0; @@ -310,6 +317,11 @@ #endif f->namebuf = 0; f->title = Qnil; + f->menu_bar_window = Qnil; + f->toolbar_window = Qnil; + f->desired_toolbar_items = f->current_toolbar_items = Qnil; + f->desired_toolbar_string = f->current_toolbar_string = Qnil; + f->n_desired_toolbar_items = f->n_current_toolbar_items = 0; root_window = make_window (); if (mini_p) @@ -357,18 +369,25 @@ a space), try to find another one. */ if (XSTRING (Fbuffer_name (buf))->data[0] == ' ') buf = Fother_buffer (buf, Qnil, Qnil); - Fset_window_buffer (root_window, buf); + /* Use set_window_buffer, not Fset_window_buffer, and don't let + hooks be run by it. The reason is that the whole frame/window + arrangement is not yet fully intialized at this point. Windows + don't have the right size, glyph matrices aren't initialized + etc. Running Lisp functions at this point surely ends in a + SEGV. */ + set_window_buffer (root_window, buf, 0); f->buffer_list = Fcons (buf, Qnil); } if (mini_p) { XWINDOW (mini_window)->buffer = Qt; - Fset_window_buffer (mini_window, - (NILP (Vminibuffer_list) - ? get_minibuffer (0) - : Fcar (Vminibuffer_list))); + set_window_buffer (mini_window, + (NILP (Vminibuffer_list) + ? get_minibuffer (0) + : Fcar (Vminibuffer_list)), + 0); } f->root_window = root_window; @@ -519,10 +538,10 @@ #ifdef MSDOS f->output_data.x = &the_only_x_display; f->output_method = output_msdos_raw; - init_frame_faces (f); #else /* not MSDOS */ f->output_data.nothing = 1; /* Nonzero means frame isn't deleted. */ #endif + init_frame_faces (f); return f; } @@ -550,7 +569,7 @@ f = make_terminal_frame (); change_frame_size (f, FRAME_HEIGHT (selected_frame), FRAME_WIDTH (selected_frame), 0, 0); - remake_frame_glyphs (f); + adjust_glyphs (f); calculate_costs (f); XSETFRAME (frame, f); Fmodify_frame_parameters (frame, Vdefault_frame_alist); @@ -1150,6 +1169,12 @@ x_clear_frame_selections (f); #endif + /* Free glyphs. + This function must be called before the window tree of the + frame is deleted because windows contain dynamically allocated + memory. */ + free_glyphs (f); + /* Mark all the windows that used to be on FRAME as deleted, and then remove the reference to them. */ delete_all_subwindows (XWINDOW (f->root_window)); @@ -1165,23 +1190,17 @@ } if (f->namebuf) - free (f->namebuf); - if (FRAME_CURRENT_GLYPHS (f)) - free_frame_glyphs (f, FRAME_CURRENT_GLYPHS (f)); - if (FRAME_DESIRED_GLYPHS (f)) - free_frame_glyphs (f, FRAME_DESIRED_GLYPHS (f)); - if (FRAME_TEMP_GLYPHS (f)) - free_frame_glyphs (f, FRAME_TEMP_GLYPHS (f)); + xfree (f->namebuf); if (FRAME_INSERT_COST (f)) - free (FRAME_INSERT_COST (f)); + xfree (FRAME_INSERT_COST (f)); if (FRAME_DELETEN_COST (f)) - free (FRAME_DELETEN_COST (f)); + xfree (FRAME_DELETEN_COST (f)); if (FRAME_INSERTN_COST (f)) - free (FRAME_INSERTN_COST (f)); + xfree (FRAME_INSERTN_COST (f)); if (FRAME_DELETE_COST (f)) - free (FRAME_DELETE_COST (f)); + xfree (FRAME_DELETE_COST (f)); if (FRAME_MESSAGE_BUF (f)) - free (FRAME_MESSAGE_BUF (f)); + xfree (FRAME_MESSAGE_BUF (f)); #ifdef HAVE_WINDOW_SYSTEM /* Free all fontset data. */