summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2014-01-10 20:32:20 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2014-01-10 20:32:20 +0000
commit9fd344172a27e63f7be1eca5131efa738d368356 (patch)
tree71bcf270e1b8ad12b63f0a45162409b3fb203673
parentef76dd468d5eefbad32ebfd2486ff79bb39c080a (diff)
downloadnetsurf-9fd344172a27e63f7be1eca5131efa738d368356.tar.gz
netsurf-9fd344172a27e63f7be1eca5131efa738d368356.tar.bz2
Enforce the use of popupmenu.library >=53.11
Older versions have a dangerous bug which manifests itself as a deadlock or a crash.
-rw-r--r--amiga/gui.c18
-rwxr-xr-xamiga/gui.h2
-rwxr-xr-xamiga/gui_options.c1
3 files changed, 20 insertions, 1 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index f223fc6ab..296132712 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -87,6 +87,7 @@
#include <proto/keymap.h>
#include <proto/locale.h>
#include <proto/Picasso96API.h>
+#include <proto/popupmenu.h>
#include <proto/utility.h>
#include <proto/wb.h>
@@ -580,9 +581,11 @@ static nserror ami_set_options(struct nsoption_s *defaults)
}
}
+ if(popupmenu_lib_ok == FALSE)
+ nsoption_set_bool(context_menu, false);
+
#ifndef __amigaos4__
nsoption_set_bool(download_notify, false);
- nsoption_set_bool(context_menu, false);
nsoption_set_bool(font_antialiasing, false);
nsoption_set_bool(truecolour_mouse_pointers, false);
#endif
@@ -999,6 +1002,19 @@ int main(int argc, char** argv)
nserror ret;
Object *splash_window = ami_gui_splash_open();
+ /* Open popupmenu.library just to check the version.
+ * Versions older than 53.11 are dangerous, so we
+ * forcibly disable context menus if these are in use.
+ */
+ popupmenu_lib_ok = FALSE;
+ if(PopupMenuBase = OpenLibrary("popupmenu.library", 53)) {
+ LOG(("popupmenu.library v%d.%d",
+ PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision));
+ if(LIB_IS_AT_LEAST((struct Library *)PopupMenuBase, 53, 11))
+ popupmenu_lib_ok = TRUE;
+ CloseLibrary(PopupMenuBase);
+ }
+
user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
current_user = ASPrintf("%s", (user == -1) ? "Default" : temp);
current_user_dir = ASPrintf("PROGDIR:Users/%s", current_user);
diff --git a/amiga/gui.h b/amiga/gui.h
index 4ec329eb8..947066063 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -176,4 +176,6 @@ struct browser_window *curbw;
struct gui_globals browserglob;
uint32 ami_appid;
BOOL ami_autoscroll;
+BOOL popupmenu_lib_ok;
#endif
+
diff --git a/amiga/gui_options.c b/amiga/gui_options.c
index 1bf20ad47..a5568dac6 100755
--- a/amiga/gui_options.c
+++ b/amiga/gui_options.c
@@ -1328,6 +1328,7 @@ void ami_gui_opts_open(void)
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_CONTEXTMENU],
GA_Selected, nsoption_bool(context_menu),
+ GA_Disabled, !popupmenu_lib_ok,
CheckBoxEnd,
#endif
LAYOUT_AddChild, gow->objects[GID_OPTS_FASTSCROLL] = CheckBoxObject,