[Xcb] [Bug 41443] New: Fatal error message when we close libX11 window application.

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Oct 4 04:15:29 PDT 2011


https://bugs.freedesktop.org/show_bug.cgi?id=41443

           Summary: Fatal error message when we close libX11 window
                    application.
           Product: XCB
           Version: unspecified
          Platform: Other
        OS/Version: Solaris
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Library
        AssignedTo: xcb at lists.freedesktop.org
        ReportedBy: arvind.umrao at oracle.com
         QAContact: xcb at lists.freedesktop.org


When we close any libX11 window application, we get following fatal error
message. Fatal error message comes only with libX11 which are based on xcb.

XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
      after 14 requests (13 known processed) with 0 events remaining.


Error is simply because I quit the application, without exiting while loop of 
XNextEvent. Fatal error will not occur if we process Window Close Event of
Window-Manager through event handler so XNextEvent does not fail, with adding
following line

Atom delWindow = XInternAtom( d, "WM_DELETE_WINDOW", 0 );
XSetWMProtocols(d , w, &delWindow, 1);

 while(1) {
     XNextEvent(d, &e);
...
     if(e.type==ClientMessage)
        {
        printf("Client Messages\n");
        break;
        }
....
   }



XCB should give same error message as our legacy xlib was giving. Fatal error
message is very confusing to developers, when they run simple 20 lines of
following test sample. 



Step to reproduce the problem
Compile following code with cc test.c -lX11 
then run ./a.out
close the application by clicking X icon


 #include <X11/Xlib.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

 int main(void) {
   Display *d;
   Window w;
   XEvent e;
   char *msg = "Hello, World!";
   int s;

                        /* open connection with the server */
   d = XOpenDisplay(NULL);
   if (d == NULL) {
     fprintf(stderr, "Cannot open display\n");
     exit(1);
   }

   s = DefaultScreen(d);

                        /* create window */
   w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 200, 200, 1,
                           BlackPixel(d, s), WhitePixel(d, s));

                        /* select kind of events we are interested in */
   XSelectInput(d, w, ExposureMask | KeyPressMask);

                        /* map (show) the window */
   XMapWindow(d, w);

                        /* event loop */
   while (1) {
     XNextEvent(d, &e);
                        /* draw or redraw the window */
     if (e.type == Expose) {
       XFillRectangle(d, w, DefaultGC(d, s), 20, 20, 10, 10);
       XDrawString(d, w, DefaultGC(d, s), 50, 50, msg, strlen(msg));
     }
                        /* exit on key press */
     if (e.type == KeyPress)
       break;
   }

                        /* close connection to server */
   XCloseDisplay(d);

   return 0;
 }

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the Xcb mailing list