Fix bug #91640. Make sure to check the offscreen window before destroying it. Also so other related cleanup. Original patch from Andrew Chatham. r/sr=blizzard,tor.

This commit is contained in:
blizzard%redhat.com 2001-08-06 18:04:07 +00:00
Родитель 90dcc96f3b
Коммит 508b4794fb
2 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -168,8 +168,7 @@ EmbedPrivate::Realize(PRBool *aAlreadyRealized)
*aAlreadyRealized = PR_FALSE; *aAlreadyRealized = PR_FALSE;
// create the offscreen window if we have to // create the offscreen window if we have to
if (!sOffscreenWindow) EnsureOffscreenWindow();
CreateOffscreenWindow();
// Have we ever been initialized before? If so then just reparetn // Have we ever been initialized before? If so then just reparetn
// from the offscreen window. // from the offscreen window.
@ -786,8 +785,10 @@ EmbedPrivate::ShutdownProfile(void)
/* static */ /* static */
void void
EmbedPrivate::CreateOffscreenWindow(void) EmbedPrivate::EnsureOffscreenWindow(void)
{ {
if (sOffscreenWindow)
return;
sOffscreenWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); sOffscreenWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_realize(sOffscreenWindow); gtk_widget_realize(sOffscreenWindow);
sOffscreenFixed = gtk_fixed_new(); sOffscreenFixed = gtk_fixed_new();
@ -799,6 +800,8 @@ EmbedPrivate::CreateOffscreenWindow(void)
void void
EmbedPrivate::DestroyOffscreenWindow(void) EmbedPrivate::DestroyOffscreenWindow(void)
{ {
if (!sOffscreenWindow)
return;
gtk_widget_destroy(sOffscreenWindow); gtk_widget_destroy(sOffscreenWindow);
sOffscreenWindow = 0; sOffscreenWindow = 0;
} }

Просмотреть файл

@ -159,7 +159,7 @@ class EmbedPrivate {
static void ShutdownProfile(void); static void ShutdownProfile(void);
// offscreen window methods and the offscreen widget // offscreen window methods and the offscreen widget
static void CreateOffscreenWindow(void); static void EnsureOffscreenWindow(void);
static void DestroyOffscreenWindow(void); static void DestroyOffscreenWindow(void);
static GtkWidget *sOffscreenWindow; static GtkWidget *sOffscreenWindow;
static GtkWidget *sOffscreenFixed; static GtkWidget *sOffscreenFixed;