2004-10-31 Jan Dj\e,Ad\e(Brv <jan.h.d@swipnet.se>
+ * 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.
+
* atimer.c (alarm_signal_handler): Do not call set_alarm if
pending_atmers is non-zero.
{
struct buffer *prev = current_buffer;
int count = SPECPDL_INDEX ();
- Lisp_Object old_tool_bar;
+ Lisp_Object new_tool_bar;
+ int new_n_tool_bar;
struct gcpro gcpro1;
/* Set current_buffer to the buffer of the selected
specbind (Qoverriding_local_map, Qnil);
}
- old_tool_bar = f->tool_bar_items;
- GCPRO1 (old_tool_bar);
+ GCPRO1 (new_tool_bar);
/* Build desired tool-bar items from keymaps. */
- BLOCK_INPUT;
- f->tool_bar_items
- = tool_bar_items (f->tool_bar_items, &f->n_tool_bar_items);
- UNBLOCK_INPUT;
+ new_tool_bar = tool_bar_items (Fcopy_sequence (f->tool_bar_items),
+ &new_n_tool_bar);
/* Redisplay the tool-bar if we changed it. */
- if (! NILP (Fequal (old_tool_bar, f->tool_bar_items)))
- w->update_mode_line = Qt;
+ if (NILP (Fequal (new_tool_bar, f->tool_bar_items)))
+ {
+ /* Redisplay that happens asynchronously due to an expose event
+ may access f->tool_bar_items. Make sure we update both
+ variables within BLOCK_INPUT so no such event interrupts. */
+ BLOCK_INPUT;
+ f->tool_bar_items = new_tool_bar;
+ f->n_tool_bar_items = new_n_tool_bar;
+ w->update_mode_line = Qt;
+ UNBLOCK_INPUT;
+ }
UNGCPRO;