[gtk-vnc-devel] possible cure for that crash....



I changed gvnc_shutdown like so:

void gvnc_shutdown(struct gvnc *gvnc)
{
       gvnc->has_error = 1;
       GVNC_DEBUG("Waking up couroutine to shutdown gracefully\n");
       g_io_wakeup(&gvnc->wait);
       close(gvnc->fd);
       gvnc->fd = -1;
}


This allows the vnc coroutine to still be able to use the socket until it can get back to the top of the server_messages routine. I don't know much about coroutines, so I hope somebody out there can affirm that the coroutine will always reach the bottom of server_message so that it can kick out (because of the has_error variable being set) and gracefully shutdown the VNC widget. Perhaps it would be wise to let the coroutine close the socket and set the FD to -1, and then change gvnc_shutdown() to look more like this...

void gvnc_shutdown(struct gvnc *gvnc)
{
       gvnc->has_error = 1;
       GVNC_DEBUG("Waking up couroutine to shutdown gracefully\n");
       while(gvnc->fd  != -1)
           g_io_wakeup(&gvnc->wait);
}


This allows the coroutine to reach a cleaned up state and close the resources it relies upon. Then the vncdisplay can do whatever cleaning up it needs to do.



Thanks, and keep up the good work

Rob Stoddard






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]