Selon Mathias Fröhlich : > On Friday 26 January 2007 21:30, Frederic Bouvier wrote: > > Update of /var/cvs/SimGear-0.3/SimGear/simgear/scene/model > > In directory baron:/tmp/cvs-serv5514 > > > > Modified Files: > > shadanim.cxx > > Log Message: > > Ensure a reference on the cube map texture is always held > > Fred, that code was correct (appart from not being deleted). I have that kind > of code at more places. > That technique called 'double checked locking'. > You don't bother locking a mutex if it is already there. But if the instance > must be created, you have to ensure that you are the only one. therefore you > need to ask if it is there a second time ... > That is not time critical here, so I don't bother locking, but in general > this > kind of code should be left as is ...
The core of the fix is the change from a pointer to a reference to avoid the deletion of the texture while the pointer still hold a non null value. -Fred -- Frédéric Bouvier http://frfoto.free.fr Photo gallery - album photo http://www.fotolia.fr/p/2278/partner/2278 Other photo gallery http://fgsd.sourceforge.net/ FlightGear Scenery Designer ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel