JerboaBurrow / Hop

Lightweight, cross-platform, 2D game engine | ECS; Lua Console; Physics; Tile based
MIT License
0 stars 1 forks source link

Segfault on release with sSpriteRender refactor #106

Closed Jerboa-app closed 11 months ago

Jerboa-app commented 12 months ago

The offending code.

No return statement on sRender::draw leads to the program skipping into the next function body, sRender::update

Absolutely blinding

        double sRender::draw
        (
            EntityComponentSystem * ecs, 
            AbstractWorld * world
        )
        {

            if (ecs != nullptr)
            {
                sSpriteRender & sprite = ecs->getSystem<sSpriteRender>();
                update(ecs);
                sprite.draw(&shaderPool);
            }

            if (world != nullptr)
            {
                world->draw(*(shaderPool.get("worldShader").get()));
            }

            auto t = std::chrono::high_resolution_clock::now();
            accumulatedTime += std::chrono::duration_cast<duration<double>>(t-clock).count();
            clock = t;

            /* return accumulatedTime; */
        }

        void sRender::update(EntityComponentSystem * ecs)
        {
            sSpriteRender & sprite = ecs->getSystem<sSpriteRender>();

            sprite.update(ecs, &shaderPool, staleShaders);

            staleShaders = false;
        }
Jerboa-app commented 12 months ago

Excellent since it was took a while to spot in even going full gdb - although there was a warning!

Jerboa-app commented 11 months ago

107