diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-10-29 22:14:48 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-10-29 22:29:06 +0000 |
commit | a221fa721360e4aef1488eddc4891e10c26cb73d (patch) | |
tree | 08312f5f7b4e20ead32c028fad0e31293b2195f0 /desktop | |
parent | 847e1111bce323ba5277c4babf70c5441233bcd7 (diff) | |
download | netsurf-a221fa721360e4aef1488eddc4891e10c26cb73d.tar.gz netsurf-a221fa721360e4aef1488eddc4891e10c26cb73d.tar.bz2 |
Ensure browser window creation returns errors from common initialisation.
The browser window common initialisation code returns error codes which
were being ignored. The errors were additionally being reported via
warn_user in inappropriate places within browser history construction.
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/browser.c | 7 | ||||
-rw-r--r-- | desktop/browser_history.c | 9 |
2 files changed, 10 insertions, 6 deletions
diff --git a/desktop/browser.c b/desktop/browser.c index e6fc2f794..a13c2948e 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -752,6 +752,7 @@ nserror browser_window_create(enum browser_window_create_flags flags, { gui_window_create_flags gw_flags = GW_CREATE_NONE; struct browser_window *ret; + nserror err; /* Check parameters */ if (flags & BW_CREATE_CLONE) { @@ -778,7 +779,11 @@ nserror browser_window_create(enum browser_window_create_flags flags, NULL); /* Initialise common parts */ - browser_window_initialise_common(flags, ret, existing); + err = browser_window_initialise_common(flags, ret, existing); + if (err != NSERROR_OK) { + browser_window_destroy(ret); + return err; + } /* window characteristics */ ret->browser_window_type = BROWSER_WINDOW_NORMAL; diff --git a/desktop/browser_history.c b/desktop/browser_history.c index 445c0ee06..309bcb2b4 100644 --- a/desktop/browser_history.c +++ b/desktop/browser_history.c @@ -416,9 +416,9 @@ static bool browser_window_history__enumerate_entry( /** * Create a new history tree for a browser window window. * - * \param bw browser window to create history for. + * \param bw browser window to create history for. * - * \return NSERROR_OK or appropriate error otherwise + * \return NSERROR_OK or appropriate error otherwise */ nserror browser_window_history_create(struct browser_window *bw) @@ -428,10 +428,10 @@ nserror browser_window_history_create(struct browser_window *bw) bw->history = NULL; history = calloc(1, sizeof *history); - if (!history) { - warn_user("NoMemory", 0); + if (history == NULL) { return NSERROR_NOMEM; } + history->width = RIGHT_MARGIN / 2; history->height = BOTTOM_MARGIN / 2; @@ -473,7 +473,6 @@ nserror browser_window_history_clone(const struct browser_window *existing, new_history->start); if (!new_history->start) { LOG(("Insufficient memory to clone history")); - warn_user("NoMemory", 0); browser_window_history_destroy(clone); clone->history = NULL; return NSERROR_NOMEM; |