summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore/ecore_main.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-08-13 10:32:20 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-08-13 10:32:20 +0000
commitdc2f7beceda99e1d4603fe59875b410cb0ab5f25 (patch)
tree048647327ad4b129c167f44abab0476306c2f9b2 /legacy/ecore/src/lib/ecore/ecore_main.c
parentfe00bc661a5986a11d2ff2faad75fcb35b6bc1b7 (diff)
patch from vtorri fixing rare segv condition in main loop
SVN revision: 75206
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore/ecore_main.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/legacy/ecore/src/lib/ecore/ecore_main.c b/legacy/ecore/src/lib/ecore/ecore_main.c
index aa9b605385..894ab33fa0 100644
--- a/legacy/ecore/src/lib/ecore/ecore_main.c
+++ b/legacy/ecore/src/lib/ecore/ecore_main.c
@@ -1941,12 +1941,21 @@ _ecore_main_win32_select(int nfds __UNUSED__,
1941 long network_event; 1941 long network_event;
1942 1942
1943 network_event = 0; 1943 network_event = 0;
1944 if (FD_ISSET(fdh->fd, readfds)) 1944 if (readfds)
1945 network_event |= FD_READ; 1945 {
1946 if (FD_ISSET(fdh->fd, writefds)) 1946 if (FD_ISSET(fdh->fd, readfds))
1947 network_event |= FD_WRITE; 1947 network_event |= FD_READ;
1948 if (FD_ISSET(fdh->fd, exceptfds)) 1948 }
1949 network_event |= FD_OOB; 1949 if (writefds)
1950 {
1951 if (FD_ISSET(fdh->fd, writefds))
1952 network_event |= FD_WRITE;
1953 }
1954 if (exceptfds)
1955 {
1956 if (FD_ISSET(fdh->fd, exceptfds))
1957 network_event |= FD_OOB;
1958 }
1950 1959
1951 if (network_event) 1960 if (network_event)
1952 { 1961 {
@@ -1986,9 +1995,12 @@ _ecore_main_win32_select(int nfds __UNUSED__,
1986 result = MsgWaitForMultipleObjects(objects_nbr, (const HANDLE *)objects, EINA_FALSE, 1995 result = MsgWaitForMultipleObjects(objects_nbr, (const HANDLE *)objects, EINA_FALSE,
1987 timeout, QS_ALLINPUT); 1996 timeout, QS_ALLINPUT);
1988 1997
1989 FD_ZERO(readfds); 1998 if (readfds)
1990 FD_ZERO(writefds); 1999 FD_ZERO(readfds);
1991 FD_ZERO(exceptfds); 2000 if (writefds)
2001 FD_ZERO(writefds);
2002 if (exceptfds)
2003 FD_ZERO(exceptfds);
1992 2004
1993 /* The result tells us the type of event we have. */ 2005 /* The result tells us the type of event we have. */
1994 if (result == WAIT_FAILED) 2006 if (result == WAIT_FAILED)
@@ -2021,11 +2033,11 @@ _ecore_main_win32_select(int nfds __UNUSED__,
2021 2033
2022 WSAEnumNetworkEvents(sockets[result], objects[result], &network_event); 2034 WSAEnumNetworkEvents(sockets[result], objects[result], &network_event);
2023 2035
2024 if (network_event.lNetworkEvents & FD_READ) 2036 if ((network_event.lNetworkEvents & FD_READ) && readfds)
2025 FD_SET(sockets[result], readfds); 2037 FD_SET(sockets[result], readfds);
2026 if (network_event.lNetworkEvents & FD_WRITE) 2038 if ((network_event.lNetworkEvents & FD_WRITE) && writefds)
2027 FD_SET(sockets[result], writefds); 2039 FD_SET(sockets[result], writefds);
2028 if (network_event.lNetworkEvents & FD_OOB) 2040 if ((network_event.lNetworkEvents & FD_OOB) && exceptfds)
2029 FD_SET(sockets[result], exceptfds); 2041 FD_SET(sockets[result], exceptfds);
2030 2042
2031 res = 1; 2043 res = 1;