How can I fix this Segmentation fault using SFML?

I am having a segmentation fault error when running this code The error is triggered at the draw function of the custom object. I believe that its related to the address of the window.

GameObject *obj = new Dummy;

//game loop
while (window.isOpen())
{
    sf::Event event;
    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            window.close();
    }
    window.clear();
    obj->draw(window);
    window.display();
}

return 0;

}

I pasted the whole code here

Answers


I fixed it. The problem was that I was loosing the texture cause it wasn't created with new, so after the constructor created it then the sprite was banished.


Need Your Help

RoR environment in Ruby standalone script

ruby-on-rails ruby environment

I want to run a standalone ruby script in which I need my RoR environment to be used. Specifically, I need my models extending ActionMailer and ActiveRecord. I also need to read the database

Silverlight Fieldset Control

silverlight control fieldset

I've been missing the classic Fieldset of HTML in Silverlight and I couldn't find any solutions on the web. How do I go about building one?

How do I detect the collison of components?

java swing components collision-detection jlabel

How do I detect the collision of components, specifically JLabels (or ImageIcons?)? I have tried this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.