mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
Don't cancel random timers in x_get_foreign_selection (bug#81108)
* src/pgtkselect.c (pgtk_display_selection_waiting_message): (pgtk_cancel_atimer): (pgtk_get_foreign_selection): * src/xselect.c (x_display_selection_waiting_message): (x_cancel_atimer): (x_get_foreign_selection): Use a pointer to a timer variable, which is cleared when the timer runs or is otherwise cancelled. Don't cancel the timer twice.
This commit is contained in:
parent
5cd7785b0a
commit
90314895dd
2 changed files with 22 additions and 8 deletions
|
|
@ -981,15 +981,22 @@ static void
|
|||
pgtk_display_selection_waiting_message (struct atimer *timer)
|
||||
{
|
||||
Lisp_Object val;
|
||||
struct atimer **atimerp = timer->client_data;
|
||||
|
||||
val = build_string ("Waiting for reply from selection owner...");
|
||||
message3_nolog (val);
|
||||
*atimerp = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
pgtk_cancel_atimer (void *atimer)
|
||||
pgtk_cancel_atimer (void *atimerp)
|
||||
{
|
||||
cancel_atimer (atimer);
|
||||
struct atimer **atimer = atimerp;
|
||||
if (*atimer)
|
||||
{
|
||||
cancel_atimer (*atimer);
|
||||
*atimer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1044,8 +1051,8 @@ pgtk_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_typ
|
|||
message_interval = make_timespec (1, 0);
|
||||
delayed_message = start_atimer (ATIMER_RELATIVE, message_interval,
|
||||
pgtk_display_selection_waiting_message,
|
||||
NULL);
|
||||
record_unwind_protect_ptr (pgtk_cancel_atimer, delayed_message);
|
||||
&delayed_message);
|
||||
record_unwind_protect_ptr (pgtk_cancel_atimer, &delayed_message);
|
||||
|
||||
/* This allows quits. Also, don't wait forever. */
|
||||
intmax_t timeout = max (0, pgtk_selection_timeout);
|
||||
|
|
|
|||
|
|
@ -1624,15 +1624,22 @@ static void
|
|||
x_display_selection_waiting_message (struct atimer *timer)
|
||||
{
|
||||
Lisp_Object val;
|
||||
struct atimer **atimerp = timer->client_data;
|
||||
|
||||
val = build_string ("Waiting for reply from selection owner...");
|
||||
message3_nolog (val);
|
||||
*atimerp = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
x_cancel_atimer (void *atimer)
|
||||
x_cancel_atimer (void *atimerp)
|
||||
{
|
||||
cancel_atimer (atimer);
|
||||
struct atimer **atimer = atimerp;
|
||||
if (*atimer)
|
||||
{
|
||||
cancel_atimer (*atimer);
|
||||
*atimer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1701,8 +1708,8 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
|
|||
message_interval = make_timespec (1, 0);
|
||||
delayed_message = start_atimer (ATIMER_RELATIVE, message_interval,
|
||||
x_display_selection_waiting_message,
|
||||
NULL);
|
||||
record_unwind_protect_ptr (x_cancel_atimer, delayed_message);
|
||||
&delayed_message);
|
||||
record_unwind_protect_ptr (x_cancel_atimer, &delayed_message);
|
||||
|
||||
/* This allows quits. Also, don't wait forever. */
|
||||
intmax_t timeout = max (0, x_selection_timeout);
|
||||
|
|
|
|||
Loading…
Reference in a new issue