Advertisement
PVS-StudioWarnings

PVS-Studio warning V509 for OGRE

Nov 21st, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.37 KB | None | 0 0
  1. #ifndef OGRE_EXCEPT
  2. #define OGRE_EXCEPT(num, desc, src) \
  3.   throw Ogre::ExceptionFactory::create( \
  4.     Ogre::ExceptionCodeType<num>(), desc, \
  5.     src, __FILE__, __LINE__ );
  6. #endif
  7.  
  8. ArchiveManager::~ArchiveManager()
  9. {
  10.   // Unload & delete resources in turn
  11.   for( ArchiveMap::iterator it = mArchives.begin();
  12.        it != mArchives.end(); ++it )
  13.   {
  14.     Archive* arch = it->second;
  15.     // Unload
  16.     arch->unload();
  17.     // Find factory to destroy
  18.     ArchiveFactoryMap::iterator fit =
  19.       mArchFactories.find(arch->getType());
  20.     if (fit == mArchFactories.end())
  21.     {
  22.       // Factory not found
  23.       OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
  24.                   "Cannot find an archive factory "
  25.                   "to deal with archive of type " +
  26.         arch->getType(),
  27.         "ArchiveManager::~ArchiveManager");
  28.     }
  29.     fit->second->destroyInstance(arch);
  30.   }
  31.   // Empty the list
  32.   mArchives.clear();
  33. }
  34.  
  35. This suspicious code was found in OGRE project by PVS-Studio static code analyzer.
  36. Warning message is:
  37. V509 The 'throw' operator inside the destructor should be placed within the try..catch block. Raising exception inside the destructor is illegal. OgreMain ogrearchivemanager.cpp 124
  38.  
  39. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement