From: Daniel Carl Date: Thu, 16 Jul 2015 21:13:50 +0000 (+0200) Subject: Fixed unset of current url on stop loading (#224). X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=4b6977feeac0358c92e046ddba9d2c504523ad82;p=vimb.git Fixed unset of current url on stop loading (#224). If and url is loaded and the real url is already available in the webview the provisional data sour seems to be not available anymore. This caused '(null)' be shown in url bar in case a page loading was aborted by CTRL-C. To fix this the provisional data source is used to get the current url as long as it exists, else the webview's url is taken. --- diff --git a/src/main.c b/src/main.c index f229e10..662b125 100644 --- a/src/main.c +++ b/src/main.c @@ -789,8 +789,12 @@ static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec) * use the provisional uri here. */ WebKitWebFrame *frame = webkit_web_view_get_main_frame(view); WebKitWebDataSource *src = webkit_web_frame_get_provisional_data_source(frame); - WebKitNetworkRequest *req = webkit_web_data_source_get_initial_request(src); - uri = webkit_network_request_get_uri(req); + if (src) { + WebKitNetworkRequest *req = webkit_web_data_source_get_initial_request(src); + uri = webkit_network_request_get_uri(req); + } else { + uri = webkit_web_view_get_uri(view); + } vb_update_urlbar(uri); #ifdef FEATURE_AUTOCMD autocmd_run(AU_LOAD_FAILED, uri, NULL);