comparison src/xdisp.c @ 57813:6cc2262110d2

* xdisp.c (update_tool_bar): Pass a copy of f->tool_bar_items to tool_bar_items and assign the result to f->tool_bar_items if not equal. Move BLOCK/UNBLOCK_INPUT from around call to tool_bar_items to assignment of result.
author Jan Djärv <jan.h.d@swipnet.se>
date Sun, 31 Oct 2004 15:11:31 +0000
parents 577483cd5a95
children 8e7f2c329808
comparison
equal deleted inserted replaced
57812:938845bec845 57813:6cc2262110d2
8414 && !NILP (XBUFFER (w->buffer)->mark_active)) 8414 && !NILP (XBUFFER (w->buffer)->mark_active))
8415 != !NILP (w->region_showing))) 8415 != !NILP (w->region_showing)))
8416 { 8416 {
8417 struct buffer *prev = current_buffer; 8417 struct buffer *prev = current_buffer;
8418 int count = SPECPDL_INDEX (); 8418 int count = SPECPDL_INDEX ();
8419 Lisp_Object old_tool_bar; 8419 Lisp_Object new_tool_bar;
8420 int new_n_tool_bar;
8420 struct gcpro gcpro1; 8421 struct gcpro gcpro1;
8421 8422
8422 /* Set current_buffer to the buffer of the selected 8423 /* Set current_buffer to the buffer of the selected
8423 window of the frame, so that we get the right local 8424 window of the frame, so that we get the right local
8424 keymaps. */ 8425 keymaps. */
8433 { 8434 {
8434 specbind (Qoverriding_terminal_local_map, Qnil); 8435 specbind (Qoverriding_terminal_local_map, Qnil);
8435 specbind (Qoverriding_local_map, Qnil); 8436 specbind (Qoverriding_local_map, Qnil);
8436 } 8437 }
8437 8438
8438 old_tool_bar = f->tool_bar_items; 8439 GCPRO1 (new_tool_bar);
8439 GCPRO1 (old_tool_bar);
8440 8440
8441 /* Build desired tool-bar items from keymaps. */ 8441 /* Build desired tool-bar items from keymaps. */
8442 BLOCK_INPUT; 8442 new_tool_bar = tool_bar_items (Fcopy_sequence (f->tool_bar_items),
8443 f->tool_bar_items 8443 &new_n_tool_bar);
8444 = tool_bar_items (f->tool_bar_items, &f->n_tool_bar_items);
8445 UNBLOCK_INPUT;
8446 8444
8447 /* Redisplay the tool-bar if we changed it. */ 8445 /* Redisplay the tool-bar if we changed it. */
8448 if (! NILP (Fequal (old_tool_bar, f->tool_bar_items))) 8446 if (NILP (Fequal (new_tool_bar, f->tool_bar_items)))
8449 w->update_mode_line = Qt; 8447 {
8448 /* Redisplay that happens asynchronously due to an expose event
8449 may access f->tool_bar_items. Make sure we update both
8450 variables within BLOCK_INPUT so no such event interrupts. */
8451 BLOCK_INPUT;
8452 f->tool_bar_items = new_tool_bar;
8453 f->n_tool_bar_items = new_n_tool_bar;
8454 w->update_mode_line = Qt;
8455 UNBLOCK_INPUT;
8456 }
8450 8457
8451 UNGCPRO; 8458 UNGCPRO;
8452 8459
8453 unbind_to (count, Qnil); 8460 unbind_to (count, Qnil);
8454 set_buffer_internal_1 (prev); 8461 set_buffer_internal_1 (prev);