diff options
author | 2010-03-12 12:35:47 +0100 | |
---|---|---|
committer | 2010-03-12 12:35:47 +0100 | |
commit | ca118d293041c241e1ab2ca07398ca11fd193518 (patch) | |
tree | 3c006f19229756be6a02259b704248162a4e7f3f /src/uzbl-core.c | |
parent | 5aa9a876c8a0e6812a1ca2217227f99e24635f6e (diff) |
remove obsolete new_window handler and fix some potential segfault issues
Diffstat (limited to 'src/uzbl-core.c')
-rw-r--r-- | src/uzbl-core.c | 66 |
1 files changed, 22 insertions, 44 deletions
diff --git a/src/uzbl-core.c b/src/uzbl-core.c index d449ab3..5ee8243 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -100,7 +100,6 @@ const struct var_name_to_ptr_t { { "forward_keys", PTR_V_INT(uzbl.behave.forward_keys, 1, NULL)}, { "cookie_handler", PTR_V_STR(uzbl.behave.cookie_handler, 1, NULL)}, { "authentication_handler", PTR_V_STR(uzbl.behave.authentication_handler, 1, set_authentication_handler)}, - { "new_window", PTR_V_STR(uzbl.behave.new_window, 1, NULL)}, { "scheme_handler", PTR_V_STR(uzbl.behave.scheme_handler, 1, NULL)}, { "fifo_dir", PTR_V_STR(uzbl.behave.fifo_dir, 1, cmd_fifo_dir)}, { "socket_dir", PTR_V_STR(uzbl.behave.socket_dir, 1, cmd_socket_dir)}, @@ -493,25 +492,40 @@ parseenv (gchar* string) { return out; } - void clean_up(void) { - send_event(INSTANCE_EXIT, uzbl.info.pid_str, NULL); - g_free(uzbl.info.pid_str); + if(uzbl.info.pid_str) { + send_event(INSTANCE_EXIT, uzbl.info.pid_str, NULL); + g_free(uzbl.info.pid_str); + uzbl.info.pid_str = NULL; + } + + if(uzbl.state.executable_path) { + g_free(uzbl.state.executable_path); + uzbl.state.executable_path = NULL; + } - g_free(uzbl.state.executable_path); if (uzbl.behave.commands) { g_hash_table_destroy(uzbl.behave.commands); uzbl.behave.commands = NULL; } - if(uzbl.state.event_buffer) + if(uzbl.state.event_buffer) { g_ptr_array_free(uzbl.state.event_buffer, TRUE); + uzbl.state.event_buffer = NULL; + } - if (uzbl.behave.fifo_dir) + if (uzbl.behave.fifo_dir) { unlink (uzbl.comm.fifo_path); - if (uzbl.behave.socket_dir) + g_free(uzbl.comm.fifo_path); + uzbl.comm.fifo_path = NULL; + } + + if (uzbl.behave.socket_dir) { unlink (uzbl.comm.socket_path); + g_free(uzbl.comm.socket_path); + uzbl.comm.socket_path = NULL; + } } gint @@ -1220,42 +1234,6 @@ dehilight (WebKitWebView *page, GArray *argv, GString *result) { webkit_web_view_set_highlight_text_matches (page, FALSE); } - -void -new_window_load_uri (const gchar * uri) { - if (uzbl.behave.new_window) { - GString *s = g_string_new (""); - g_string_printf(s, "'%s'", uri); - run_handler(uzbl.behave.new_window, s->str); - send_event(NEW_WINDOW, s->str, NULL); - return; - } - GString* to_execute = g_string_new (""); - g_string_append_printf (to_execute, "%s --uri '%s'", uzbl.state.executable_path, uri); - int i; - for (i = 0; entries[i].long_name != NULL; i++) { - if ((entries[i].arg == G_OPTION_ARG_STRING) && - !strcmp(entries[i].long_name,"uri") && - !strcmp(entries[i].long_name,"name")) { - gchar** str = (gchar**)entries[i].arg_data; - if (*str!=NULL) - g_string_append_printf (to_execute, " --%s '%s'", entries[i].long_name, *str); - } - else if(entries[i].arg == G_OPTION_ARG_STRING_ARRAY) { - int j; - gchar **str = *((gchar ***)entries[i].arg_data); - for(j=0; str[j]; j++) - g_string_append_printf(to_execute, " --%s '%s'", entries[i].long_name, str[j]); - } - } - if (uzbl.state.verbose) - printf("\n%s\n", to_execute->str); - g_spawn_command_line_async (to_execute->str, NULL); - /* TODO: should we just report the uri as event detail? */ - send_event(NEW_WINDOW, to_execute->str, NULL); - g_string_free (to_execute, TRUE); -} - void chain (WebKitWebView *page, GArray *argv, GString *result) { (void) page; (void) result; |