emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: alarm_signal_handler is called too frequently


From: Jan D.
Subject: Re: alarm_signal_handler is called too frequently
Date: Thu, 28 Oct 2004 20:02:13 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040916

Richard Stallman wrote:

    so popup_get_selection is not used for the non-toolkit build at all.

That means item 3 is not a real problem.  That is good.

    > 2. However, popup_get_selection is called inside BLOCK_INPUT, and it
    > calls timer_check, which can call Lisp code.  This seems to be a bug.

I still think that is a real problem.

    It craches, but directly at start before any interaction.  Disabling the
toolbar (./emacs -q -xrm '*toolBar: 0') makes it start OK, but it does not
    crash on any popup menu.

1. If it does not crash with popup menus, that could be because no
timer was running.  Were there any timers that should have run?  Maybe
something else disables the running of timers from
popup_get_selection.  In that case, there is no bug here, but the code
to check timers is misleading.

Timers are running (scheduled), The version that uses Xt has a timer that runs every 0.1 seconds, and I also have a blinking cursor. But see below.


2. Is popup_get_selection used, the way you compiled Emacs?

I tried it both ways, i.e. Emacs compiled with Lucid/Motif and GTK/no toolkit.

The reason no timers are actualy run is this code in alarm_signal_handler in atimer.c:
  while (atimers
         && (pending_atimers = interrupt_input_blocked) == 0
         && EMACS_TIME_LE (atimers->expiration, now))
  ...

Since popups are within BLOCK/UNBLOCK__INPUT, the signal handler just reschedules the alarm without running any timer code.



3. Can you debug the crash that does happen?  I think anything that
causes a crash with this patch has the potential to cause crashes
occasionally even without this patch.

It is because of this code in update_tool_bar, xdisp.c:

          /* 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;

The BLOCK/UNBLOCK_INPUT is needed for the GTK version.  This was discussed here
http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-05/msg00155.html

The solution proposed was to do as the menu code does, first build the structures from Lisp code, then update the GUI. Only the second stage needs to block input. Unfortunately this has not been done yet (on my todo list).

        Jan D.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]