Return the Image by ref ptr instead of raw pointer.
}
//----------------------------------------------------------------------------
- osg::Image* FGCanvasSystemAdapter::getImage(const std::string& path) const
+ osg::ref_ptr<osg::Image> FGCanvasSystemAdapter::getImage(const std::string& path) const
{
if( SGPath(path).isAbsolute() )
{
{
SGPath tpath = globals->resolve_resource_path(path);
if( !tpath.isNull() )
- return osgDB::readImageFile(tpath.c_str());
+ return osgDB::readRefImageFile(tpath.c_str());
SG_LOG(SG_IO, SG_ALERT, "canvas::Image: No such image: '" << path << "'");
}
virtual simgear::canvas::FontPtr getFont(const std::string& name) const;
virtual void addCamera(osg::Camera* camera) const;
virtual void removeCamera(osg::Camera* camera) const;
- virtual osg::Image* getImage(const std::string& path) const;
+ virtual osg::ref_ptr<osg::Image> getImage(const std::string& path) const;
virtual SGSubsystem* getSubsystem(const std::string& name) const;
virtual simgear::HTTP::Client* getHTTPClient() const;
};