Mercurial > pidgin
changeset 29711:87b166bd3760
merge of '512105f86bd25c63994d1ab26ed4d4998773c923'
and 'a65c9ee5c5782d7276caae4991630797f79a2ce8'
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 12 Apr 2010 06:49:00 +0000 |
parents | 0417d6bc47cd (current diff) ac49f12cddeb (diff) |
children | 48e15c705add |
files | |
diffstat | 2 files changed, 18 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkeventloop.c Mon Apr 12 04:01:07 2010 +0000 +++ b/pidgin/gtkeventloop.c Mon Apr 12 06:49:00 2010 +0000 @@ -41,11 +41,6 @@ } PidginIOClosure; -static void pidgin_io_destroy(gpointer data) -{ - g_free(data); -} - static gboolean pidgin_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) { PidginIOClosure *closure = data; @@ -57,7 +52,7 @@ purple_cond |= PURPLE_INPUT_WRITE; #if 0 - purple_debug(PURPLE_DEBUG_MISC, "gtk_eventloop", + purple_debug_misc("gtk_eventloop", "CLOSURE: callback for %d, fd is %d\n", closure->result, g_io_channel_unix_get_fd(source)); #endif @@ -65,7 +60,7 @@ #ifdef _WIN32 if(! purple_cond) { #ifdef DEBUG - purple_debug(PURPLE_DEBUG_MISC, "gtk_eventloop", + purple_debug:misc("gtk_eventloop", "CLOSURE received GIOCondition of 0x%x, which does not" " match 0x%x (READ) or 0x%x (WRITE)\n", condition, PIDGIN_READ_COND, PIDGIN_WRITE_COND); @@ -110,10 +105,10 @@ channel = g_io_channel_unix_new(fd); closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, - pidgin_io_invoke, closure, pidgin_io_destroy); + pidgin_io_invoke, closure, g_free); #if 0 - purple_debug(PURPLE_DEBUG_MISC, "gtk_eventloop", + purple_debug_misc("gtk_eventloop", "CLOSURE: adding input watcher %d for fd %d\n", closure->result, fd); #endif
--- a/pidgin/gtkmain.c Mon Apr 12 04:01:07 2010 +0000 +++ b/pidgin/gtkmain.c Mon Apr 12 06:49:00 2010 +0000 @@ -167,7 +167,7 @@ if ((pid == (pid_t) - 1) && (errno != ECHILD)) { char errmsg[BUFSIZ]; - snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid); + snprintf(errmsg, sizeof(errmsg), "Warning: waitpid() returned %d", pid); perror(errmsg); } } @@ -539,10 +539,11 @@ char errmsg[BUFSIZ]; GIOChannel *signal_channel; GIOStatus signal_status; + guint signal_channel_watcher; #ifndef DEBUG char *segfault_message_tmp; #endif - GError *error = NULL; + GError *error; #endif int opt; gboolean gui_check; @@ -608,6 +609,7 @@ /* we have to convert the message (UTF-8 to console charset) early because after a segmentation fault it's not a good practice to allocate memory */ + error = NULL; segfault_message = g_locale_from_utf8(segfault_message_tmp, -1, NULL, NULL, &error); if (segfault_message != NULL) { @@ -652,7 +654,8 @@ "binary: %s", error->message); exit(1); } - g_io_add_watch(signal_channel, G_IO_IN, mainloop_sighandler, NULL); + signal_channel_watcher = g_io_add_watch(signal_channel, G_IO_IN, mainloop_sighandler, NULL); + g_io_channel_unref(signal_channel); /* Let's not violate any PLA's!!!! */ /* jseymour: whatever the fsck that means */ @@ -660,31 +663,31 @@ * useful signals like SIGCHLD, so we unblock all the ones we * * declare a handler for. thanks JSeymour and Vann. */ if (sigemptyset(&sigset)) { - snprintf(errmsg, BUFSIZ, "Warning: couldn't initialise empty signal set"); + snprintf(errmsg, sizeof(errmsg), "Warning: couldn't initialise empty signal set"); perror(errmsg); } for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) { if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) { - snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d for catching", + snprintf(errmsg, sizeof(errmsg), "Warning: couldn't set signal %d for catching", catch_sig_list[sig_indx]); perror(errmsg); } if(sigaddset(&sigset, catch_sig_list[sig_indx])) { - snprintf(errmsg, BUFSIZ, "Warning: couldn't include signal %d for unblocking", + snprintf(errmsg, sizeof(errmsg), "Warning: couldn't include signal %d for unblocking", catch_sig_list[sig_indx]); perror(errmsg); } } for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) { if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) { - snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d to ignore", + snprintf(errmsg, sizeof(errmsg), "Warning: couldn't set signal %d to ignore", ignore_sig_list[sig_indx]); perror(errmsg); } } if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) { - snprintf(errmsg, BUFSIZ, "Warning: couldn't unblock signals"); + snprintf(errmsg, sizeof(errmsg), "Warning: couldn't unblock signals"); perror(errmsg); } #endif @@ -977,6 +980,9 @@ #ifdef HAVE_SIGNAL_H g_free(segfault_message); + g_source_remove(signal_channel_watcher); + close(signal_sockets[0]); + close(signal_sockets[1]); #endif #ifdef _WIN32