dont call pipe handler if its deleted

SVN revision: 56251
This commit is contained in:
Carsten Haitzler 2011-01-21 06:25:36 +00:00
parent 4208f2445b
commit cea2587c3b
1 changed files with 15 additions and 10 deletions

View File

@ -538,6 +538,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
}
else if (ret == 0)
{
if (!p->delete_me)
p->handler((void *)p->data, NULL, 0);
pipe_close(p->fd_read);
p->fd_read = PIPE_FD_INVALID;
@ -546,7 +547,8 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
return ECORE_CALLBACK_CANCEL;
}
#ifndef _WIN32
else if ((ret == PIPE_FD_ERROR) && ((errno == EINTR) || (errno == EAGAIN)))
else if ((ret == PIPE_FD_ERROR) &&
((errno == EINTR) || (errno == EAGAIN)))
{
_ecore_pipe_unhandle(p);
return ECORE_CALLBACK_RENEW;
@ -564,6 +566,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
if (WSAGetLastError() != WSAEWOULDBLOCK)
{
if (!p->delete_me)
p->handler((void *)p->data, NULL, 0);
pipe_close(p->fd_read);
p->fd_read = PIPE_FD_INVALID;
@ -586,6 +589,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
/* catch the non error case first */
if (ret == (ssize_t)(p->len - p->already_read))
{
if (!p->delete_me)
p->handler((void *)p->data, p->passed_data, p->len);
free(p->passed_data);
/* reset all values to 0 */
@ -601,6 +605,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
}
else if (ret == 0)
{
if (!p->delete_me)
p->handler((void *)p->data, NULL, 0);
pipe_close(p->fd_read);
p->fd_read = PIPE_FD_INVALID;
@ -609,10 +614,9 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
return ECORE_CALLBACK_CANCEL;
}
#ifndef _WIN32
else if (ret == PIPE_FD_ERROR && (errno == EINTR || errno == EAGAIN))
{
else if ((ret == PIPE_FD_ERROR) &&
((errno == EINTR) || (errno == EAGAIN)))
return ECORE_CALLBACK_RENEW;
}
else
{
ERR("An unhandled error (ret: %zd errno: %d)"
@ -626,6 +630,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
if (WSAGetLastError() != WSAEWOULDBLOCK)
{
if (!p->delete_me)
p->handler((void *)p->data, NULL, 0);
pipe_close(p->fd_read);
p->fd_read = PIPE_FD_INVALID;