Avoid unlikely int overflow.
* src/pgtkterm.c (pgtk_term_init): * src/xterm.c (x_term_init): Use a bool, not an int that keeps incrementing, to record whether initialization has occurred.
This commit is contained in:
parent
6ff06ff738
commit
a1e4f6a35c
2 changed files with 8 additions and 7 deletions
|
@ -7004,7 +7004,7 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)
|
|||
GdkDisplay *dpy;
|
||||
struct terminal *terminal;
|
||||
struct pgtk_display_info *dpyinfo;
|
||||
static int x_initialized = 0;
|
||||
static bool x_initialized;
|
||||
static unsigned x_display_id = 0;
|
||||
static char *initial_display = NULL;
|
||||
char *dpy_name;
|
||||
|
@ -7015,6 +7015,7 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)
|
|||
|
||||
block_input ();
|
||||
|
||||
bool was_initialized = x_initialized;
|
||||
if (!x_initialized)
|
||||
{
|
||||
any_help_event_p = false;
|
||||
|
@ -7025,8 +7026,7 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)
|
|||
#ifdef USE_CAIRO
|
||||
gui_init_fringe (&pgtk_redisplay_interface);
|
||||
#endif
|
||||
|
||||
++x_initialized;
|
||||
x_initialized = true;
|
||||
}
|
||||
|
||||
dpy_name = SSDATA (display_name);
|
||||
|
@ -7041,7 +7041,7 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)
|
|||
char **argv2 = argv;
|
||||
guint id;
|
||||
|
||||
if (x_initialized++ > 1)
|
||||
if (was_initialized)
|
||||
{
|
||||
xg_display_open (dpy_name, &dpy);
|
||||
}
|
||||
|
|
|
@ -30382,7 +30382,7 @@ static bool x_timeout_atimer_activated_flag;
|
|||
|
||||
#endif /* USE_X_TOOLKIT */
|
||||
|
||||
static int x_initialized;
|
||||
static bool x_initialized;
|
||||
|
||||
/* Test whether two display-name strings agree up to the dot that separates
|
||||
the screen number from the server number. */
|
||||
|
@ -30594,10 +30594,11 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
|||
|
||||
block_input ();
|
||||
|
||||
bool was_initialized = x_initialized;
|
||||
if (!x_initialized)
|
||||
{
|
||||
x_initialize ();
|
||||
++x_initialized;
|
||||
x_initialized = true;
|
||||
}
|
||||
|
||||
#if defined USE_X_TOOLKIT || defined USE_GTK
|
||||
|
@ -30615,7 +30616,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
|||
char **argv2 = argv;
|
||||
guint id;
|
||||
|
||||
if (x_initialized++ > 1)
|
||||
if (was_initialized)
|
||||
{
|
||||
xg_display_open (SSDATA (display_name), &dpy);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue