reverted the last change and did a different fix that involves closing the

2004-04-10  Sven Neumann  <sven@gimp.org>

	* tools/gimp-remote.c (start_new_gimp): reverted the last change
	and did a different fix that involves closing the X display before
	starting gimp (bug #139158).
This commit is contained in:
Sven Neumann 2004-04-10 10:25:36 +00:00 committed by Sven Neumann
parent f53d2850dd
commit 27addd2ed7
2 changed files with 29 additions and 24 deletions

View file

@ -1,3 +1,9 @@
2004-04-10 Sven Neumann <sven@gimp.org>
* tools/gimp-remote.c (start_new_gimp): reverted the last change
and did a different fix that involves closing the X display before
starting gimp (bug #139158).
2004-04-09 Manish Singh <yosh@gimp.org>
* plug-ins/common/jpeg.c: Uglier workaround for bug #138357, since

View file

@ -56,6 +56,13 @@
#define GIMP_BINARY "gimp-" GIMP_APP_VERSION
static void start_new_gimp (GdkDisplay *display,
GdkScreen *screen,
const gchar *argv0,
const gchar *startup_id,
GString *file_list) G_GNUC_NORETURN;
static gboolean existing = FALSE;
static gboolean query = FALSE;
@ -176,7 +183,8 @@ usage (const gchar *name)
}
static void
start_new_gimp (GdkScreen *screen,
start_new_gimp (GdkDisplay *display,
GdkScreen *screen,
const gchar *argv0,
const gchar *startup_id,
GString *file_list)
@ -253,30 +261,19 @@ start_new_gimp (GdkScreen *screen,
break;
}
/* We must ensure that gimp is started with a different PID.
Otherwise it could happen that (when it opens it's display) it sends
the same auth token again (because that one is uniquified with PID
and time()), which the server would deny. */
switch (fork ())
{
case -1:
exit (EXIT_FAILURE);
/* Close the display so that gimp can reopen it later without getting
* into authentification problems with the X server (see bug #139158).
*/
XCloseDisplay (gdk_x11_display_get_xdisplay (display));
case 0: /* child */
execv (gimp, argv);
execvp (GIMP_BINARY, argv);
execv (gimp, argv);
execvp (GIMP_BINARY, argv);
/* if execv and execvp return, there was an error */
g_printerr ("Couldn't start %s for the following reason: %s\n",
GIMP_BINARY, g_strerror (errno));
/* if execv and execvp return, there was an arror */
g_printerr ("Couldn't start %s for the following reason: %s\n",
GIMP_BINARY, g_strerror (errno));
exit (EXIT_FAILURE);
default: /* parent */
break;
}
exit (EXIT_SUCCESS);
exit (EXIT_FAILURE);
}
static void
@ -401,7 +398,8 @@ main (gint argc,
/* if called without any filenames, always start a new GIMP */
if (file_list->len == 0 && !query && !existing)
{
start_new_gimp (screen, argv[0], desktop_startup_id, file_list);
start_new_gimp (display, screen,
argv[0], desktop_startup_id, file_list);
}
gimp_window = gimp_remote_find_window (display, screen);
@ -471,7 +469,8 @@ main (gint argc,
}
else if (! existing)
{
start_new_gimp (screen, argv[0], desktop_startup_id, file_list);
start_new_gimp (display, screen,
argv[0], desktop_startup_id, file_list);
}
}