From 78fd5ccbf6ebd85329cb0df999b6e259c9e915ce Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 20 Mar 2016 20:28:20 +0000 Subject: fix new creating new window assert --- windows/window.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'windows/window.c') diff --git a/windows/window.c b/windows/window.c index d3f2c99c5..1dd2bfdc9 100644 --- a/windows/window.c +++ b/windows/window.c @@ -858,6 +858,36 @@ void win32_window_set_scroll(struct gui_window *w, int sx, int sy) } +/** + * Create a new window due to menu selection + * + * \param gw frontends graphical window. + * \return NSERROR_OK on success else appropriate error code. + */ +static nserror win32_open_new_window(struct gui_window *gw) +{ + const char *addr; + nsurl *url; + nserror ret; + + if (nsoption_charp(homepage_url) != NULL) { + addr = nsoption_charp(homepage_url); + } else { + addr = NETSURF_HOMEPAGE; + } + + ret = nsurl_create(addr, &url); + if (ret == NSERROR_OK) { + ret = browser_window_create(BW_CREATE_HISTORY, + url, + NULL, + gw->bw, + NULL); + nsurl_unref(url); + } + + return ret; +} static LRESULT nsws_window_command(HWND hwnd, @@ -868,7 +898,8 @@ nsws_window_command(HWND hwnd, { nserror ret; - LOG("notification_code %x identifier %x ctrl_window %p", notification_code, identifier, ctrl_window); + LOG("notification_code %x identifier %x ctrl_window %p", + notification_code, identifier, ctrl_window); switch(identifier) { @@ -888,11 +919,7 @@ nsws_window_command(HWND hwnd, break; case IDM_FILE_OPEN_WINDOW: - ret = browser_window_create(BW_CREATE_NONE, - NULL, - NULL, - gw->bw, - NULL); + ret = win32_open_new_window(gw); if (ret != NSERROR_OK) { warn_user(messages_get_errorcode(ret), 0); } -- cgit v1.2.3