fix occasional memory leak

This commit is contained in:
Eric House 2013-06-26 00:41:16 -07:00
parent 8324b9c770
commit 0bb4f5b0f5

View file

@ -2190,6 +2190,9 @@ gtk_socket_changed( void* closure, int oldSock, int newSock, void** storage )
globals ); globals );
info->channel = channel; info->channel = channel;
info->watch = result; info->watch = result;
if ( !!*storage ) {
XP_FREE( globals->cGlobals.params->util->mpool, *storage );
}
*storage = info; *storage = info;
XP_LOGF( "g_io_add_watch(%d) => %d", newSock, result ); XP_LOGF( "g_io_add_watch(%d) => %d", newSock, result );
} }
@ -2273,12 +2276,11 @@ drop_msg_toggle( GtkWidget* toggle, GtkAppGlobals* globals )
} /* drop_msg_toggle */ } /* drop_msg_toggle */
#endif #endif
static GtkAppGlobals* g_globals_for_signal;
static void static void
handle_sigintterm( int XP_UNUSED(sig) ) handle_sigintterm( int XP_UNUSED(sig) )
{ {
LOG_FUNC(); LOG_FUNC();
gtk_main_quit(); gtk_main_quit(); /* ok to call from signal handler? I bet not. */
} }
int int
@ -2296,7 +2298,6 @@ gtkmain( LaunchParams* params, int argc, char *argv[] )
GtkWidget* dropCheck; GtkWidget* dropCheck;
#endif #endif
g_globals_for_signal = &globals;
struct sigaction act = { .sa_handler = handle_sigintterm }; struct sigaction act = { .sa_handler = handle_sigintterm };
sigaction( SIGINT, &act, NULL ); sigaction( SIGINT, &act, NULL );
sigaction( SIGTERM, &act, NULL ); sigaction( SIGTERM, &act, NULL );