Avoid calling AllocSignal() until the last minute, as it causes PM_OPEN to initiate

an Intuition or Input deadlock.
Re-enable context menus as they are now safe.
Remove sticky context menus option as this can be set in GUI prefs as a global option.

svn path=/trunk/netsurf/; revision=12698
This commit is contained in:
Chris Young 2011-09-02 17:31:47 +00:00
parent a7d4f08b77
commit 25fea2721d
4 changed files with 19 additions and 36 deletions

View File

@ -173,6 +173,7 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
int box_y=0;
bool menuhascontent = false;
bool no_url = true, no_obj = true, no_sel = true;
ULONG ret = 0;
if(!cc) return;
if(content_get_type(cc) != CONTENT_HTML) return;
@ -408,6 +409,7 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
if(!menuhascontent) return;
gui_window_set_pointer(gwin->bw->window,GUI_POINTER_DEFAULT);
IDoMethod(ctxmenuobj,PM_OPEN,gwin->win);
}

View File

@ -147,7 +147,6 @@ Class *urlStringClass;
BOOL locked_screen = FALSE;
BOOL screen_closed = FALSE;
ULONG screen_signal = -1;
struct MsgPort *applibport = NULL;
ULONG applibsig = 0;
@ -308,8 +307,6 @@ void ami_open_resources(void)
ASLFR_RejectIcons,TRUE,
ASLFR_InitialDrawer,option_download_dir,
TAG_DONE);
screen_signal = AllocSignal(-1);
}
void ami_set_options(void)
@ -540,7 +537,6 @@ void ami_openscreen(void)
SA_Type, PUBLICSCREEN,
SA_PubName, "NetSurf",
SA_LikeWorkbench, TRUE,
SA_PubSig, screen_signal,
TAG_DONE);
if(scrn)
@ -1201,13 +1197,7 @@ void ami_handle_msg(void)
switch(code)
{
case MENUDOWN:
if(!option_sticky_context_menu)
ami_context_menu_show(gwin,x,y);
break;
case MENUUP:
if(option_sticky_context_menu)
ami_context_menu_show(gwin,x,y);
ami_context_menu_show(gwin,x,y);
break;
case SELECTUP:
@ -2138,14 +2128,27 @@ void ami_quit_netsurf(void)
void ami_gui_close_screen(struct Screen *scrn)
{
ULONG screen_signal = AllocSignal(-1);
ULONG scrnsig = 1 << screen_signal;
if(scrn == NULL) return;
if(CloseScreen(scrn)) return;
SetScreenAttr(scrn, SA_PubSig, screen_signal, sizeof(ULONG));
if(scrn == NULL)
{
FreeSignal(screen_signal);
return;
}
if(CloseScreen(scrn))
{
FreeSignal(screen_signal);
return;
}
LOG(("Waiting for visitor windows to close..."));
Wait(scrnsig);
CloseScreen(scrn);
FreeSignal(screen_signal);
}
void gui_quit(void)
@ -2173,7 +2176,6 @@ void gui_quit(void)
/* If it is our public screen, close it or wait until the visitor windows leave */
if(locked_screen == FALSE) ami_gui_close_screen(scrn);
FreeSignal(screen_signal);
FreeVec(nsscreentitle);

View File

@ -118,7 +118,6 @@ enum
GID_OPTS_SEARCH_PROV,
GID_OPTS_CLIPBOARD,
GID_OPTS_CMENU_ENABLE,
GID_OPTS_CMENU_STICKY,
GID_OPTS_STARTUP_NO_WIN,
GID_OPTS_CLOSE_NO_QUIT,
GID_OPTS_DOCKY,
@ -285,7 +284,6 @@ void ami_gui_opts_setup(void)
gadlab[GID_OPTS_SEARCH_PROV] = (char *)ami_utf8_easy((char *)messages_get("SearchProvider"));
gadlab[GID_OPTS_CLIPBOARD] = (char *)ami_utf8_easy((char *)messages_get("ClipboardUTF8"));
gadlab[GID_OPTS_CMENU_ENABLE] = (char *)ami_utf8_easy((char *)messages_get("Enable"));
gadlab[GID_OPTS_CMENU_STICKY] = (char *)ami_utf8_easy((char *)messages_get("Sticky"));
gadlab[GID_OPTS_STARTUP_NO_WIN] = (char *)ami_utf8_easy((char *)messages_get("OptionNoWindow"));
gadlab[GID_OPTS_CLOSE_NO_QUIT] = (char *)ami_utf8_easy((char *)messages_get("OptionNoQuit"));
gadlab[GID_OPTS_DOCKY] = (char *)ami_utf8_easy((char *)messages_get("OptionDocky"));
@ -1137,13 +1135,6 @@ void ami_gui_opts_open(void)
GA_Text, gadlab[GID_OPTS_CMENU_ENABLE],
GA_Selected, option_context_menu,
CheckBoxEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_CMENU_STICKY] = CheckBoxObject,
GA_ID, GID_OPTS_CMENU_STICKY,
GA_RelVerify, TRUE,
GA_Disabled, !option_context_menu,
GA_Text, gadlab[GID_OPTS_CMENU_STICKY],
GA_Selected, option_sticky_context_menu,
CheckBoxEnd,
LayoutEnd, // context menus
CHILD_WeightedHeight, 0,
LayoutEnd, // temp extra group for spacing
@ -1594,10 +1585,6 @@ void ami_gui_opts_use(void)
if(data) option_context_menu = true;
else option_context_menu = false;
GetAttr(GA_Selected,gow->objects[GID_OPTS_CMENU_STICKY],(ULONG *)&data);
if(data) option_sticky_context_menu = true;
else option_sticky_context_menu = false;
GetAttr(GA_Selected,gow->objects[GID_OPTS_STARTUP_NO_WIN],(ULONG *)&data);
if(data) option_startup_no_window = true;
else option_startup_no_window = false;
@ -1829,11 +1816,6 @@ BOOL ami_gui_opts_event(void)
IDoMethod(gow->objects[GID_OPTS_DLDIR],
GFILE_REQUEST,gow->win);
break;
case GID_OPTS_CMENU_ENABLE:
RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_CMENU_STICKY],
gow->win, NULL, GA_Disabled, !code, TAG_DONE);
break;
}
break;
}

View File

@ -28,7 +28,6 @@ extern int option_cache_bitmaps;
extern char *option_theme;
extern bool option_utf8_clipboard;
extern bool option_context_menu;
extern bool option_sticky_context_menu;
extern bool option_truecolour_mouse_pointers;
extern bool option_use_os_pointers;
extern bool option_new_tab_active;
@ -76,8 +75,7 @@ char *option_modeid = 0; \
int option_cache_bitmaps = 0; \
char *option_theme = 0; \
bool option_utf8_clipboard = false; \
bool option_context_menu = false; \
bool option_sticky_context_menu = false; \
bool option_context_menu = true; \
bool option_truecolour_mouse_pointers = false; \
bool option_use_os_pointers = true; \
bool option_new_tab_active = false; \
@ -126,7 +124,6 @@ bool option_widescreen = false; \
{ "theme", OPTION_STRING, &option_theme}, \
{ "clipboard_write_utf8", OPTION_BOOL, &option_utf8_clipboard}, \
{ "context_menu", OPTION_BOOL, &option_context_menu}, \
{ "sticky_context_menu", OPTION_BOOL, &option_sticky_context_menu}, \
{ "truecolour_mouse_pointers", OPTION_BOOL, &option_truecolour_mouse_pointers}, \
{ "os_mouse_pointers", OPTION_BOOL, &option_use_os_pointers}, \
{ "new_tab_is_active", OPTION_BOOL, &option_new_tab_active}, \