X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/71e9885be0a84f3c544b992aeb3a842f821035b5..11a23db53128bf244a089123b7fd27deb577a889:/src/gtk/evtloop.cpp diff --git a/src/gtk/evtloop.cpp b/src/gtk/evtloop.cpp index ea5b43b9d1..59d0e31c18 100644 --- a/src/gtk/evtloop.cpp +++ b/src/gtk/evtloop.cpp @@ -2,10 +2,9 @@ // Name: src/gtk/evtloop.cpp // Purpose: implements wxEventLoop for GTK+ // Author: Vadim Zeitlin -// Modified by: // Created: 10.07.01 -// RCS-ID: $Id$ // Copyright: (c) 2001 Vadim Zeitlin +// (c) 2013 Rob Bresalier, Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -124,14 +123,24 @@ static gboolean wx_on_channel_event(GIOChannel *channel, wxEventLoopSourceHandler * const handler = static_cast(data); - if (condition & G_IO_IN || condition & G_IO_PRI) + if ( (condition & G_IO_IN) || (condition & G_IO_PRI) || (condition & G_IO_HUP) ) handler->OnReadWaiting(); + if (condition & G_IO_OUT) handler->OnWriteWaiting(); - else if (condition & G_IO_ERR || condition & G_IO_NVAL) + + if ( (condition & G_IO_ERR) || (condition & G_IO_NVAL) ) handler->OnExceptionWaiting(); // we never want to remove source here, so always return true + // + // The source may have been removed by the handler, so it may be + // a good idea to return FALSE when the source has already been + // removed. However, that would involve somehow informing this function + // that the source was removed, which is not trivial to implement + // and handle all cases. It has been found through testing + // that if the source was removed by the handler, that even if we + // return TRUE here, the source/callback will not get called again. return TRUE; } }