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

Author Topic: sf::Image complains about "pure virtual function call&a  (Read 4325 times)

0 Members and 2 Guests are viewing this topic.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
sf::Image complains about "pure virtual function call&a
« on: February 27, 2009, 09:54:59 pm »
Yo! While trying some stuff on Vista I get this error when exiting the application (When the sf::Image object is being destroyed)

Quote from: "Vista"
Runtime Error!

Program: {Path to application}

R6025
 - pure virtual function call


Return value of this is 255 (0xFF).
I've tried to isolate a special case though I'm not sure but I think it is when I don't use the image and just create it. But then if I have two images, each with an own sprite and then draw them, the exact same error is back.

** UPDATE **
This only happens when I load the image data from a file. Gonna try what happens if I change file and fileformat.

** UPDATE **
I tried changing file and format, no change in behaviour.

** UPDATE **
Only happens after I have loaded the image from a file.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
sf::Image complains about "pure virtual function call&a
« Reply #1 on: February 28, 2009, 03:22:57 pm »
Minimal example code to reproduce your issue would be helpful.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
sf::Image complains about "pure virtual function call&a
« Reply #2 on: February 28, 2009, 03:41:46 pm »
Code: [Select]

sf::Image img;
img.LoadFromFile("image.png");


I know it's weird, it worked before, but suddenly yesterday it stopped working???
Though my vista has been acting weird lately... gonna try out the same code in Linux soon.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Astrof

  • Full Member
  • ***
  • Posts: 135
    • View Profile
sf::Image complains about "pure virtual function call&a
« Reply #3 on: March 01, 2009, 06:37:20 am »
I had that problem once, it's usually when an Image is invalid or something.  (for me it happened when I moved from loading an Image directly and then through a reference returned by a resource manager).  

Are you sure the LoadFromFile does not return false? (IE the image exists)?
Maybe its a directory issue? (what IDE are you using?)

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
sf::Image complains about "pure virtual function call&a
« Reply #4 on: March 01, 2009, 03:24:26 pm »
The image is correct and it finds it and it can set it to a sprite and draws it correctly. Everything works perfectly until it comes to the sf::Image::~Image() or whatever, when it destroys the image.

I'm using Codeblocks, I'm in Linux right now and about to try out the exact same source code and see what happens.

** UPDATE **
I tried it on linux and no error whatsoever appeared.
Everything worked perfectly. So it's a Windows/Vista specific error. I have tried to reinstall it with no success.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Wizzard

  • Full Member
  • ***
  • Posts: 213
    • View Profile
sf::Image complains about "pure virtual function call&a
« Reply #5 on: March 02, 2009, 09:07:28 pm »
It seems as if the destructor of your image is being called after the OpenGL context has been deleted.

Make sure your sf::Image instance does not exceed the lifetime of your sf::RenderWindow instance.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::Image complains about "pure virtual function call&a
« Reply #6 on: March 02, 2009, 11:15:01 pm »
Quote from: "Wizzard"
It seems as if the destructor of your image is being called after the OpenGL context has been deleted.

Make sure your sf::Image instance does not exceed the lifetime of your sf::RenderWindow instance.

This shouldn't be a problem with SFML, the lifetime of resources is not tied to the window, even if they depend on an OpenGL context.
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
sf::Image complains about "pure virtual function call&a
« Reply #7 on: March 03, 2009, 10:40:28 am »
Quote from: "Laurent"
Quote from: "Wizzard"
It seems as if the destructor of your image is being called after the OpenGL context has been deleted.

Make sure your sf::Image instance does not exceed the lifetime of your sf::RenderWindow instance.

This shouldn't be a problem with SFML, the lifetime of resources is not tied to the window, even if they depend on an OpenGL context.


Yeah seems like that, since it works in Linux.
Could be that it's just my Vista being strange. Hmppf... Unix is da zhizzle
Developer and Maker of rbSFML and Programmer at Paradox Development Studio