[PATCH] Initialize event_notify after allocating the memory for it.

2009-01-31 Thread Brian Rogers
An uninitialized or otherwise invalid condition variable can apparently
cause a hang in pthread_cond_broadcast. Ekiga, openoffice, and xine
at least are freezing as a result of event_notify never being initialized.

Signed-off-by: Brian Rogers br...@xyzw.org
---
 src/xcb_disp.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/xcb_disp.c b/src/xcb_disp.c
index d976064..584380c 100644
--- a/src/xcb_disp.c
+++ b/src/xcb_disp.c
@@ -94,6 +94,9 @@ int _XConnectXCB(Display *dpy, _Xconst char *display, char 
**fullnamep, int *scr
dpy-xcb-next_xid = xcb_generate_id(dpy-xcb-connection);
 
dpy-xcb-event_notify = xcondition_malloc();
+   if (!dpy-xcb-event_notify)
+   return 0;
+   xcondition_init(dpy-xcb-event_notify);
return !xcb_connection_has_error(c);
 }
 
-- 
1.6.0.4

___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: [PATCH] Initialize event_notify after allocating the memory for it.

2009-01-31 Thread Barton C Massey
Thanks hugely for this catch, Brian!  Looks like one of
those hard-to-catch things where most of the time it would
come back 0, which on most machines is a proper
initialization.

Pushed.

Bart Massey
b...@cs.pdx.edu


In message 1233427071-19581-2-git-send-email-br...@xyzw.org you wrote:
 An uninitialized or otherwise invalid condition variable can apparently
 cause a hang in pthread_cond_broadcast. Ekiga, openoffice, and xine
 at least are freezing as a result of event_notify never being initialized.
 
 Signed-off-by: Brian Rogers br...@xyzw.org
 ---
  src/xcb_disp.c |3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
 
 diff --git a/src/xcb_disp.c b/src/xcb_disp.c
 index d976064..584380c 100644
 --- a/src/xcb_disp.c
 +++ b/src/xcb_disp.c
 @@ -94,6 +94,9 @@ int _XConnectXCB(Display *dpy, _Xconst char *display, char 
 **fullnamep, int *scr
   dpy-xcb-next_xid = xcb_generate_id(dpy-xcb-connection);
  
   dpy-xcb-event_notify = xcondition_malloc();
 + if (!dpy-xcb-event_notify)
 + return 0;
 + xcondition_init(dpy-xcb-event_notify);
   return !xcb_connection_has_error(c);
  }
  
 -- 
 1.6.0.4
 
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg