-void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket *socket,
- GSocketEvent event)
-{
- int *m_id = (int *)(socket->m_gui_dependent);
- int c;
-
- switch (event)
- {
- case GSOCK_LOST: /* fall-through */
- case GSOCK_INPUT: c = 0; break;
- case GSOCK_OUTPUT: c = 1; break;
- case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
- default: return;
- }
-
- if ( m_id[c] == -1 )
- return;
-
- int fd = m_id[c];
- m_id[c] = -1;
-
- const wxFDIODispatcherEntryFlags flag = c == 0 ? wxFDIO_INPUT : wxFDIO_OUTPUT;
-
- wxSelectDispatcher * const dispatcher = wxSelectDispatcher::Get();
- if ( !dispatcher )
- return;
-
- wxGSocketIOHandler * const
- handler = wx_static_cast(wxGSocketIOHandler *, dispatcher->FindHandler(fd));
- if ( handler )
- {
- handler->RemoveFlag(flag);
-
- if ( !handler->GetFlags() )
- {
- dispatcher->UnregisterFD(fd);
- delete handler;
- }
- else
- {
- dispatcher->ModifyFD(fd, handler, handler->GetFlags());
- }
- }
- else
- {
- dispatcher->UnregisterFD(fd);
- }
+ if ( !handler->GetFlags() )
+ {
+ dispatcher->UnregisterFD(fd);
+ delete handler;
+ socket->m_handler = NULL;
+ }
+ else
+ {
+ dispatcher->ModifyFD(fd, handler, handler->GetFlags());
+ }
+ }
+ else
+ {
+ dispatcher->UnregisterFD(fd);
+ }