4

I'm using X11 and when I run my program the window displays fine, but when I quit the following error is outputted in the console:

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

I have looked in the documentation but I can't find out anything on what this actually means.

xpt
  • 20,363
  • 37
  • 127
  • 216
Adam Yaxley
  • 670
  • 1
  • 7
  • 13
  • 2
    That paDisplay class looks weird. Why make everything static? Also the way it uses OpenGL is prolematic. For example the GL context may be unbound/rebound by other parts of the program, so glXMakeCurrent should be called before any function dealing with OpenGL, or better yet, the OpenGL contexts should be managed by an individual class. The initOpenGL function does stuff that's to be done in the display function, by the rendering code. Setting viewport and projection are part of the rendering, not window setup! – datenwolf Apr 06 '11 at 07:30
  • I was making everything static because it was more a collection of functions and variables than a class. I.e. in my program you shouldnt be able to create more than one window. And the OpenGL context will always be bound for the whole duration the program runs. But I do think your idea is good to just seperate things out more to perhaps make it more readable and well structured. Are you saying the setting vierport and projection should perhaps be moved to the paDisplay::stepBegin() function. Sorry it looks bad I am just trying to hide most of the complex code from the main program. – Adam Yaxley Apr 06 '11 at 07:53
  • I just tried moving the viewport and projection funtions to the renderning, but the problem is still present. What exactly happens is the window is created successfully, but nothing displays inside, its not a white color, it is just whatever was behind the window is still present inside. – Adam Yaxley Apr 06 '11 at 07:54
  • Well, then instead of a class, use a namespace, that's what they were invented for. Your "private" functions would become "static" functions only visible in the module. About moving the code in initOpenGL: This is just for clean style and to keep the code (and once elaborate rendering methods are used) your mind sane. And last but not least: I don't see the setpBegin and stepEnd functions actually being called. – datenwolf Apr 06 '11 at 10:50
  • They get called in the main loop. I just seperated everything into a window, and a renderer and then a display which handles everything and i get a different error: Fatal IO Error 104 (connection reset by peer). It would be really useful If I knew what function was causing it? Do you know anywhere that lists the errors, the xlib documentation feels a bit skinny. – Adam Yaxley Apr 06 '11 at 16:15
  • I have fixed it now. it is a very simple solution: The values for width and height weren't set! Nowhere in the code I had set the values width and height, I had just set the function arguments w and h. Pretty stupid right? And the above error 11 only refers to when you shut down the window without destroying the context and closing the connection. Simple stuff really. I can't believe i missed it. Well thanks for your help datenwolf I completely restructured my code to make it much much nicer, and you taught me about namespaces. Thankyou sincerly. – Adam Yaxley Apr 06 '11 at 22:41

2 Answers2

3

I have gotten the same error message from clicking on the (X) button to close the window. When I closed the window in a manual way, it worked.

That is an oddity from the X11 protocol - the (X) by default just deletes your window and then you try to release handles that have already been released. The odd thing is that there is no XEvent for the window closing. Instead you get a ClientMessage event, that comes from the Window Manager). Here is a good description on how to handle that: Intercept WM_DELETE_WINDOW on X11?

Community
  • 1
  • 1
Algoman
  • 1,905
  • 16
  • 16
2

The error is because I quit the application without closing the display using XCloseDisplay().

David Guyon
  • 2,759
  • 1
  • 28
  • 40
Adam Yaxley
  • 670
  • 1
  • 7
  • 13