Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 29, 2008, 11:27:45 PM (16 years ago)
Author:
rgrieder
Message:

Fixed bug in CameraHandler: when calling requestFocus twice, the camera was added twice. So deleting it once left a potentially deleted pointer in the list —> segfault.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/CameraHandler.cc

    r2030 r2064  
    6969            this->cameraList_.front()->removeFocus();
    7070
     71        camera->setFocus(this->viewport_);
     72
    7173        // add to list
     74        std::list<Camera*>::iterator it;
     75        for (it = this->cameraList_.begin(); it != this->cameraList_.end(); ++it)
     76        {
     77            if ((*it) == camera)
     78                return; // make sure we don't add it twice
     79        }
    7280        this->cameraList_.push_front(camera);
    73         camera->setFocus(this->viewport_);
    7481    }
    7582
Note: See TracChangeset for help on using the changeset viewer.