diff options
author | portix <none@none> | 2013-01-30 14:31:25 +0100 |
---|---|---|
committer | portix <none@none> | 2013-01-30 14:31:25 +0100 |
commit | 104656fb4614eee2b0ad9e06bb6483e0197863d6 (patch) | |
tree | a3c9248fce97e87d7102c1fdbf14ec331259fd9b /src/editor.c | |
parent | 88c83fc2e0025e1df372f8b5b9ce649218d5f788 (diff) | |
download | dwb-104656fb4614eee2b0ad9e06bb6483e0197863d6.zip |
Disconnect from navigation-policy-decision-requested in editor_watch
Diffstat (limited to 'src/editor.c')
-rw-r--r-- | src/editor.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/editor.c b/src/editor.c index ccef61aa..cdf1fff7 100644 --- a/src/editor.c +++ b/src/editor.c @@ -30,6 +30,20 @@ typedef struct _EditorInfo { char *tagname; } EditorInfo; +GMutex s_disconnect_mutex; + +static void +disconnect_navigation(GList *gl) +{ + g_mutex_lock(&s_disconnect_mutex); + if (VIEW(gl)->status->signals[SIG_EDITOR_NAVIGATION] != 0) + { + g_signal_handler_disconnect(VIEW(gl)->web, VIEW(gl)->status->signals[SIG_EDITOR_NAVIGATION]); + VIEW(gl)->status->signals[SIG_EDITOR_NAVIGATION] = 0; + } + g_mutex_unlock(&s_disconnect_mutex); +} + /* dwb_editor_watch (GChildWatchFunc) {{{*/ static void editor_watch(GPid pid, int status, EditorInfo *info) @@ -75,12 +89,15 @@ editor_watch(GPid pid, int status, EditorInfo *info) webkit_dom_html_text_area_element_set_value(WEBKIT_DOM_HTML_TEXT_AREA_ELEMENT(e), content); clean: + disconnect_navigation(info->gl); + unlink(info->filename); g_free(info->filename); g_free(info->id); g_free(info); }/*}}}*/ + static gboolean navigation_cb(WebKitWebView *web, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *action, WebKitWebPolicyDecision *policy, EditorInfo *info) @@ -90,7 +107,7 @@ navigation_cb(WebKitWebView *web, WebKitWebFrame *frame, WebKitNetworkRequest *r info->element = NULL; g_free(info->id); info->id = NULL; - g_signal_handler_disconnect(web, VIEW(info->gl)->status->signals[SIG_EDITOR_NAVIGATION]); + disconnect_navigation(info->gl); } return false; } |