Enforce the use of popupmenu.library >=53.11

Older versions have a dangerous bug which manifests itself as a deadlock or a crash.
This commit is contained in:
Chris Young 2014-01-10 20:32:20 +00:00
parent ef76dd468d
commit 9fd344172a
3 changed files with 20 additions and 1 deletions

View File

@ -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);

View File

@ -176,4 +176,6 @@ struct browser_window *curbw;
struct gui_globals browserglob;
uint32 ami_appid;
BOOL ami_autoscroll;
BOOL popupmenu_lib_ok;
#endif

View File

@ -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,