From 84f0c760e6cadb2ccf3c7f5abd91990ab8b5c62f Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 14 Apr 2020 21:08:51 +0100 Subject: use form of window create which returns an error instead of aborting --- frontends/riscos/cookies.c | 10 +++++++++- frontends/riscos/global_history.c | 11 ++++++++++- frontends/riscos/hotlist.c | 10 +++++++++- frontends/riscos/local_history.c | 11 ++++++++++- 4 files changed, 38 insertions(+), 4 deletions(-) (limited to 'frontends') diff --git a/frontends/riscos/cookies.c b/frontends/riscos/cookies.c index 125d04356..4884950a1 100644 --- a/frontends/riscos/cookies.c +++ b/frontends/riscos/cookies.c @@ -342,6 +342,7 @@ cookie_menu_select(wimp_w w, */ static nserror ro_cookie_init(void) { + os_error *error; struct ro_cookie_window *ncwin; nserror res; static const struct ns_menu cookie_menu_def = { @@ -383,7 +384,14 @@ static nserror ro_cookie_init(void) } /* create window from template */ - ncwin->core.wh = wimp_create_window(dialog_cookie_template); + error = xwimp_create_window(dialog_cookie_template, &ncwin->core.wh); + if (error) { + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); + ro_warn_user("WimpError", error->errmess); + free(ncwin); + return NSERROR_NOMEM; + } ro_gui_set_window_title(ncwin->core.wh, messages_get("Cookies")); diff --git a/frontends/riscos/global_history.c b/frontends/riscos/global_history.c index 7dfc58317..4f0dbd48c 100644 --- a/frontends/riscos/global_history.c +++ b/frontends/riscos/global_history.c @@ -367,6 +367,7 @@ global_history_menu_select(wimp_w w, */ static nserror ro_global_history_init(void) { + os_error *error; struct ro_global_history_window *ncwin; nserror res; static const struct ns_menu global_history_menu_def = { @@ -411,7 +412,15 @@ static nserror ro_global_history_init(void) } /* create window from template */ - ncwin->core.wh = wimp_create_window(dialog_global_history_template); + error = xwimp_create_window(dialog_global_history_template, + &ncwin->core.wh); + if (error) { + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); + ro_warn_user("WimpError", error->errmess); + free(ncwin); + return NSERROR_NOMEM; + } ro_gui_set_window_title(ncwin->core.wh, messages_get("GlobalHistory")); diff --git a/frontends/riscos/hotlist.c b/frontends/riscos/hotlist.c index b0ed1e2f4..7e18ce88e 100644 --- a/frontends/riscos/hotlist.c +++ b/frontends/riscos/hotlist.c @@ -423,6 +423,7 @@ hotlist_menu_select(wimp_w w, */ static nserror ro_hotlist_init(void) { + os_error *error; struct ro_hotlist_window *ncwin; nserror res; static const struct ns_menu hotlist_menu_def = { @@ -472,7 +473,14 @@ static nserror ro_hotlist_init(void) } /* create window from template */ - ncwin->core.wh = wimp_create_window(dialog_hotlist_template); + error = xwimp_create_window(dialog_hotlist_template, &ncwin->core.wh); + if (error) { + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); + ro_warn_user("WimpError", error->errmess); + free(ncwin); + return NSERROR_NOMEM; + } ro_gui_set_window_title(ncwin->core.wh, messages_get("Hotlist")); diff --git a/frontends/riscos/local_history.c b/frontends/riscos/local_history.c index 3e4e5c31c..03f1d8657 100644 --- a/frontends/riscos/local_history.c +++ b/frontends/riscos/local_history.c @@ -289,6 +289,7 @@ static nserror ro_local_history_init(struct browser_window *bw, struct ro_local_history_window **win_out) { + os_error *error; struct ro_local_history_window *ncwin; nserror res; @@ -306,7 +307,15 @@ ro_local_history_init(struct browser_window *bw, } /* create window from template */ - ncwin->core.wh = wimp_create_window(dialog_local_history_template); + error = xwimp_create_window(dialog_local_history_template, + &ncwin->core.wh); + if (error) { + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); + ro_warn_user("WimpError", error->errmess); + free(ncwin); + return NSERROR_NOMEM; + } /* initialise callbacks */ ncwin->core.draw = ro_local_history_draw; -- cgit v1.2.3