summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjell.ahlstedt@bredband.net>2016-12-12 09:25:56 +0100
committerKjell Ahlstedt <kjell.ahlstedt@bredband.net>2016-12-12 09:25:56 +0100
commit0cf0e6aabc983f30491cabb8713700caf42bffef (patch)
tree7b2a4fa9db1d676be933b343d356d1e040cc7f3c
parent30abb2180219bc328cb522b6aaf97a9cf79fe1a1 (diff)
downloadglibmm-0cf0e6aabc983f30491cabb8713700caf42bffef.tar.gz
Glib::Dispatcher: Don't cast a HANDLE to an int on Windows
* glib/glibmm/dispatcher.cc: When a Windows HANDLE must be cast, cast it to Glib::PollFD::fd_t instead of int. Bug 772074
-rw-r--r--glib/glibmm/dispatcher.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/glib/glibmm/dispatcher.cc b/glib/glibmm/dispatcher.cc
index e21914a8..d9067a34 100644
--- a/glib/glibmm/dispatcher.cc
+++ b/glib/glibmm/dispatcher.cc
@@ -198,11 +198,11 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context)
try
{
-#ifdef G_OS_WIN32
- const int fd = GPOINTER_TO_INT(fd_receiver_);
-#else
- const int fd = fd_receiver_;
-#endif
+ // PollFD::fd_t is the type of GPollFD::fd.
+ // In Windows, it has the same size as HANDLE, but it's not guaranteed to be the same type.
+ // In Unix, a file descriptor is an int.
+ const auto fd = (PollFD::fd_t)fd_receiver_;
+
// The following code is equivalent to
// context_->signal_io().connect(
// sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler), fd, Glib::IO_IN);