Only allocate a signal for screen closure at the point we need it. This ensures there are enough free signals for popupmenu.library (at the moment, at least)

This commit is contained in:
Chris Young 2014-02-06 21:23:24 +00:00
parent bf3ed6a67f
commit cd9268761c
1 changed files with 11 additions and 8 deletions

View File

@ -163,7 +163,7 @@ Class *urlStringClass;
BOOL locked_screen = FALSE;
BOOL screen_closed = FALSE;
ULONG screen_signal = -1;
struct MsgPort *applibport = NULL;
ULONG applibsig = 0;
BOOL refresh_search_ico = FALSE;
@ -443,7 +443,6 @@ void ami_open_resources(void)
ami_file_req_init();
ami_help_init(NULL);
screen_signal = AllocSignal(-1); /* for screen closure notification */
}
static UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo)
@ -773,7 +772,6 @@ void ami_openscreen(void)
SA_PubName, "NetSurf",
SA_LikeWorkbench, TRUE,
SA_Compositing, compositing,
SA_PubSig, screen_signal,
TAG_DONE);
if(scrn)
@ -2783,20 +2781,26 @@ void ami_quit_netsurf_delayed(void)
void ami_gui_close_screen(struct Screen *scrn, BOOL locked_screen)
{
ULONG scrnsig = 1 << screen_signal;
ULONG screen_signal = -1;
if(scrn == NULL) return;
if(CloseScreen(scrn)) return;
if(locked_screen == TRUE) return;
/* If this is our own screen, wait for visitor windows to close */
LOG(("Waiting for visitor windows to close... (signal)"));
Wait(scrnsig);
if(screen_signal = AllocSignal(-1) != -1) {
ULONG scrnsig = 1 << screen_signal;
SetScreenAttr(scrn, SA_PubSig, (APTR)screen_signal, sizeof(ULONG));
LOG(("Waiting for visitor windows to close... (signal)"));
Wait(scrnsig);
}
while (CloseScreen(scrn) == FALSE) {
LOG(("Still waiting for visitor windows to close... (polling)"));
LOG(("Waiting for visitor windows to close... (polling)"));
Delay(50);
}
FreeSignal(screen_signal);
}
static void gui_quit(void)
@ -2823,7 +2827,6 @@ static void gui_quit(void)
LOG(("Closing screen"));
ami_gui_close_screen(scrn, locked_screen);
FreeVec(nsscreentitle);
FreeSignal(screen_signal);
LOG(("Freeing menu items"));
ami_context_menu_free();