Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: X error on program exit  (Read 2255 times)

0 Members and 1 Guest are viewing this topic.

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
X error on program exit
« on: May 09, 2011, 02:39:21 am »
Hmm. I'm using Arch on a netbook (the Acer Aspire One D255), and when I close my program I get the following error:
Code: [Select]

X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request:  137 (DRI2)
  Minor opcode of failed request:  7 (DRI2GetBuffersWithFormat )
  Resource id in failed request:  0x2200006
  Serial number of failed request:  187
  Current serial number in output stream:  187

Is this the code's fault, or is it xf86-video-intel's fault?
Thanks

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
X error on program exit
« Reply #1 on: May 09, 2011, 07:53:57 am »
It's most likely a driver bug.
Laurent Gomila - SFML developer

Gallaecio

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: X error on program exit
« Reply #2 on: May 18, 2012, 08:22:30 pm »
I run into this, and found out how to solve it. It was quite simple, actually.

I was doing this:

while (window.IsOpened())
{
  sf::Event event;
  while(window.GetEvent(event))
  {
    // Window-broad event handling.
    if (event.Type == sf::Event::Closed)  window.Close();
    // [More event handling]
  }

  // [OpenGL Rendering]
  window.Display();
}

Now, I am doing this instead:

while (window.IsOpened())
{
  // [OpenGL Rendering]
  window.Display();

  sf::Event event;
  while(window.GetEvent(event))
  {
    // Window-broad event handling.
    if (event.Type == sf::Event::Closed)  { window.Close(); break; }
    // [More event handling]
  }
}

Before, I was closing the window and later calling window.Display(), which I guess was triggering the error. Now, upon close action on the user side, I close the window, break the event handling (any additional event will not matter since the application is being closed), and since the event handling is now at the end of the loop, there is no further call to window.Display().

Now the output is clean when leaving the application :)
« Last Edit: May 19, 2012, 07:46:55 am by Gallaecio »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: X error on program exit
« Reply #3 on: May 18, 2012, 08:24:22 pm »
sf::Window's functions are safe when the window has been closed. The error most likely came from your OpenGL calls.
Laurent Gomila - SFML developer

 

anything