summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2008-12-07 21:50:04 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2008-12-07 21:50:04 +0000
commit3e715853118e88880f1783d6baffd6638f4ccf63 (patch)
tree91c3fdf6bc79ded9883a7bd3c371cfc37f7e69fe
parent7c695048aefaa3eb1fcc07e27f27b3bc408fe3aa (diff)
downloadnetsurf-3e715853118e88880f1783d6baffd6638f4ccf63.tar.gz
netsurf-3e715853118e88880f1783d6baffd6638f4ccf63.tar.bz2
When a visitor window was present on NetSurf's public screen and NetSurf was quit, the
screen would fail to close. Re-launching NetSurf would then fail to open a public screen as a public screen with the same name was already open. The window would end up on the Workbench screen and then crash as the pointer to the screen being used was NULL. This fixes the problem by closing the ARexx port early (this stops any new sessions from thinking NetSurf is still running) and looping until Intuition closes the screen. Running NetSurf will check for a public screen of name NetSurf if opening a new screen fails and use this if present. It will also fall back to using the Workbench screen if both opening a new screen and locking an existing NetSurf screen fails. svn path=/trunk/netsurf/; revision=5886
-rwxr-xr-xamiga/gui.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 6dbedb68c..d0bacfad4 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -110,6 +110,7 @@ struct KeymapIFace *IKeymap = NULL;
struct BitMap *throbber = NULL;
ULONG throbber_width,throbber_height,throbber_frames;
BOOL rmbtrapped;
+BOOL locked_screen = FALSE;
static struct RastPort dummyrp;
@@ -428,12 +429,7 @@ void gui_init2(int argc, char** argv)
if(id == INVALID_ID) die(messages_get("NoMode"));
}
- if(option_use_wb)
- {
- scrn = LockPubScreen("Workbench");
- UnlockPubScreen(NULL,scrn);
- }
- else
+ if(!option_use_wb)
{
scrn = OpenScreenTags(NULL,
SA_Width,option_window_screen_width,
@@ -446,7 +442,27 @@ void gui_init2(int argc, char** argv)
SA_LikeWorkbench,TRUE,
TAG_DONE);
- if(scrn) PubScreenStatus(scrn,0);
+ if(scrn)
+ {
+ PubScreenStatus(scrn,0);
+ }
+ else
+ {
+ if(scrn = LockPubScreen("NetSurf"))
+ {
+ locked_screen = TRUE;
+ }
+ else
+ {
+ option_use_wb = true;
+ }
+ }
+ }
+
+ if(option_use_wb)
+ {
+ scrn = LockPubScreen("Workbench");
+ locked_screen = TRUE;
}
}
@@ -525,6 +541,8 @@ void gui_init2(int argc, char** argv)
}
if(!bw) bw = browser_window_create(option_homepage_url, 0, 0, true,false);
+
+ if(locked_screen) UnlockPubScreen(NULL,scrn);
}
void ami_handle_msg(void)
@@ -1160,7 +1178,12 @@ void gui_quit(void)
hubbub_finalise(myrealloc,NULL);
#endif
- if(!option_use_wb) CloseScreen(scrn);
+ ami_arexx_cleanup();
+
+ if(!locked_screen) /* set if we are using somebody else's screen */
+ {
+ while(!CloseScreen(scrn));
+ }
p96FreeBitMap(dummyrp.BitMap);
FreeVec(nsscreentitle);
@@ -1179,7 +1202,6 @@ void gui_quit(void)
ami_clipboard_free();
- ami_arexx_cleanup();
FreeSysObject(ASOT_PORT,appport);
FreeSysObject(ASOT_PORT,sport);