[gtkmm] Another IOChannel question



Hello,

Thanks to Tassos, I now use IOChannel.
But, when I delete the connection, it crashs. I have a class, called CTraceSocket, deriving from SigC::Object.
I have a method,

CTraceSocket::createIOChannel
{
 m_ioChannel=Glib::IOChannel::create_from_win32_socket((int)m_hSocket);
 m_ioSource = m_ioChannel->create_watch(Glib::IO_IN);
 m_connection = m_ioSource->connect(SigC::slot(*this,&CTraceSocket::OnIO));
 m_ioSource->set_priority(Glib::PRIORITY_DEFAULT_IDLE);
 m_ioSource->attach();
 m_ioChannel->set_close_on_unref(false);
}

(m_ioChannel and m_ioSource are smart pointers in IOChannel and IOSource respectivly).
m_hSocket is the socket handle contained in the class.

The OnIO member function is called whenever data arrive on the socket. I use the m_hSocket to access the socket.

When I connect, I create a new CTraceSocket (using new).
When I disconnect, I remove the object (using delete). It crashes (access violation), before entering in my destructor. It's probably while the destruction of either m_ioSource, or m_ioChannel.

Any idea ?

Ben






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