don't leak epoll descriptor

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-07-14 20:22:27 +00:00
parent 0a6c4c2e3b
commit d31a4a84fb
2 changed files with 10 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ public:
// the caller should delete the returned pointer // the caller should delete the returned pointer
static wxEpollDispatcher *Create(); static wxEpollDispatcher *Create();
virtual ~wxEpollDispatcher();
// implement base class pure virtual methods // implement base class pure virtual methods
virtual bool RegisterFD(int fd, wxFDIOHandler* handler, int flags = wxFDIO_ALL); virtual bool RegisterFD(int fd, wxFDIOHandler* handler, int flags = wxFDIO_ALL);
virtual bool ModifyFD(int fd, wxFDIOHandler* handler, int flags = wxFDIO_ALL); virtual bool ModifyFD(int fd, wxFDIOHandler* handler, int flags = wxFDIO_ALL);

View File

@@ -92,6 +92,14 @@ wxEpollDispatcher::wxEpollDispatcher(int epollDescriptor)
m_epollDescriptor = epollDescriptor; m_epollDescriptor = epollDescriptor;
} }
wxEpollDispatcher::~wxEpollDispatcher()
{
if ( close(m_epollDescriptor) != 0 )
{
wxLogSysError(_("Error closing epoll descriptor"));
}
}
bool wxEpollDispatcher::RegisterFD(int fd, wxFDIOHandler* handler, int flags) bool wxEpollDispatcher::RegisterFD(int fd, wxFDIOHandler* handler, int flags)
{ {
epoll_event ev; epoll_event ev;