diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-05-13 12:29:53 +0200 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-05-13 12:29:53 +0200 | 
| commit | fc2ee0f84c1746cb17c448ee75c4206dca548325 (patch) | |
| tree | c9067ffbdbf83505e0cb78863ea16a732a271887 /protocols/events_libevent.c | |
| parent | b642f38161474516c8e9fda1a9942d45a4ea9f22 (diff) | |
It works, it works! \o/
Diffstat (limited to 'protocols/events_libevent.c')
| -rw-r--r-- | protocols/events_libevent.c | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/protocols/events_libevent.c b/protocols/events_libevent.c index b9464093..bcfb3b45 100644 --- a/protocols/events_libevent.c +++ b/protocols/events_libevent.c @@ -71,6 +71,7 @@ static void b_event_passthrough( int fd, short event, void *data )  {  	struct b_event_data *b_ev = data;  	b_input_condition cond = 0; +	int id;  	if( fd >= 0 )  	{ @@ -82,10 +83,14 @@ static void b_event_passthrough( int fd, short event, void *data )  	event_debug( "b_event_passthrough( %d, %d, 0x%x ) (%d)\n", fd, event, (int) data, b_ev->id ); +	/* Since the called function might cancel this handler already +	   (which free()s b_ev, we have to remember the ID here. */ +	id = b_ev->id; +	  	if( !b_ev->function( b_ev->data, fd, cond ) )  	{  		event_debug( "Handler returned FALSE: " ); -		b_event_remove( b_ev->id ); +		b_event_remove( id );  	}  } @@ -150,7 +155,7 @@ void b_event_remove( gint id )  	}  	else  	{ -		event_debug( "Invalid?\n" ); +		event_debug( "Double remove?\n" );  	}  } | 
