diff options
author | Kjell Ahlstedt <kjell.ahlstedt@bredband.net> | 2016-12-06 16:41:14 +0100 |
---|---|---|
committer | Kjell Ahlstedt <kjell.ahlstedt@bredband.net> | 2016-12-06 16:41:14 +0100 |
commit | da9c5f725335b7b819a3909faff5bd53bdec4299 (patch) | |
tree | c98096e906d7c20389c4e6a913c7fc203a4cb2f0 /glib | |
parent | eb7b40400f95169dc4b8016a1c615df90c062764 (diff) | |
download | glibmm-da9c5f725335b7b819a3909faff5bd53bdec4299.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
Diffstat (limited to 'glib')
-rw-r--r-- | glib/glibmm/dispatcher.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/glib/glibmm/dispatcher.cc b/glib/glibmm/dispatcher.cc index 3c8a65d0..73b69be8 100644 --- a/glib/glibmm/dispatcher.cc +++ b/glib/glibmm/dispatcher.cc @@ -165,8 +165,6 @@ private: /**** Glib::DispatchNotifier ***********************************************/ -// static - thread_local DispatchNotifier* DispatchNotifier::thread_specific_instance_ = nullptr; DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context) @@ -186,11 +184,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); |