It crashes on line 24, which is almost impossible.
1st, I checked these variables.
2nd, I called g_object_ref(self) to avoid self being disposed while this function has not returned.
The only explanation is that : after dispose is called but before finalize is called, g_object_ref still could succeed!
Is that true?
- static gboolean vivs_net_inspiration_on_recv(GIOChannel *source, GIOCondition condition, gpointer data)
- {
- VivsNetInspiration* self = VIVS_NET_INSPIRATION(data);
- if(!g_object_ref(self))
- return FALSE;
- g_mutex_lock(self->priv->lock);
- gsize length = 0;
- GError* err = NULL;
- if(self->priv->channel && self->priv->composition)
- {
- GIOStatus status = g_io_channel_read_chars(self->priv->channel,
- self->priv->pkt_buffer, MAX_PKT_LEN, &length, &err);
- if(G_IO_STATUS_NORMAL == status)
- {
- // ??????????? the following line crash because self->priv->composition is NULL
- // at this moment, which is almost impossible.
- // composition could only be null after dispose, but I have called g_object_ref(self)
- // How can this happen!!
- vivs_icomposition_write(self->priv->composition, self->priv->pkt_buffer, length);
- }
- else if(G_IO_STATUS_AGAIN != status)
- {
- g_assert(err != NULL);
- g_error_free(err);
- }
-
}
- on_return:
- g_mutex_unlock(self->priv->lock);
- g_object_unref(self);
- return TRUE;
- }
--
look to the things around you,the immediate world around you, if you are alive,it will mean something to you ——Paul Strand
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list