Index: vortex_channel.c =================================================================== --- vortex_channel.c (revision 3354) +++ vortex_channel.c (working copy) @@ -881,13 +881,14 @@ /* finally, invoke caller with channel result */ if (data->threaded) { + if( channel ) { /* ensure we do not lost the reference during the * channel notification */ vortex_channel_ref (channel); /* invoke the channel created handler */ - data->on_channel_created (channel ? channel->channel_num : -1, - channel ? channel : NULL, + data->on_channel_created (channel->channel_num, + channel, data->user_data); /* if piggyback is defined, invoke the frame received @@ -902,7 +903,9 @@ /* unref the channel here */ vortex_channel_unref (channel); - + } else { + data->on_channel_created (-1, NULL, data->user_data); + } /* free no longer needed data */ vortex_channel_data_free (data); return NULL; @@ -4066,6 +4069,8 @@ v_return_val_if_fail (channel, false); v_return_val_if_fail (channel->channel_num >= 0, false); + vortex_log (LOG_DOMAIN, VORTEX_LEVEL_DEBUG, "vortex_channel_close of channel #%d",channel->channel_num); + /* check if the caller is trying to close the channel that was * notified to be closed */ if (vortex_channel_get_data (channel, VORTEX_CHANNEL_CLOSE_HANDLER_CALLED)) {