shewu / h4ck4th0n

Holy Balls: The Game
8 stars 2 forks source link

unholyballs has a leak and crashes if there are lots of objects #52

Open shewu opened 9 years ago

shewu commented 9 years ago

screen shot 2015-06-14 at 3 51 43 pm

void UnholyGameViewController::_drawObjects() {
    glEnable(GL_NORMALIZE);
    for (auto& iter : world->getMovingRoundObjects()) {
        MovingRoundObject* obj = iter.second;
        glPushMatrix();
        glTranslatef(obj->center.x, obj->center.y, 0);
        glScalef(obj->radius, obj->radius, obj->heightRatio*obj->radius);
        MaterialPtr color = obj->getMaterial();
        glColor3f(color->getR()/255.0f, color->getG()/255.0f, color->getB()/255.0f);
        gluSphere(_quad, 1.0, 50, 50);
        glPopMatrix();
    }
    glDisable(GL_NORMALIZE);
}

crashed because obj == NULL