PVS-StudioWarnings

PVS-Studio warning V599 for ffdshow

Nov 18th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.16 KB | None | 0 0
  1. class TsubtitleParser : public TsubtitleParserBase { .... }
  2. class TsubtitleParserSubrip09 : public TsubtitleParser { .... }
  3.  
  4. // Factory Pattern
  5. TsubtitleParserBase* TsubtitleParserBase::getParser(
  6.   int format, double fps, const TsubtitlesSettings *cfg,
  7.   const Tconfig *ffcfg, Tsubreader *subreader,
  8.   bool utf8, bool isEmbedded)
  9. {
  10.   switch (format & Tsubreader::SUB_FORMATMASK) {
  11.   case Tsubreader::SUB_MICRODVD  :
  12.     return new TsubtitleParserMicrodvd(...);
  13.   case Tsubreader::SUB_SUBRIP    :
  14.     return new TsubtitleParserSubrip(...);
  15.   case Tsubreader::SUB_SUBVIEWER :
  16.     return new TsubtitleParserSubviewer(...);
  17.   case Tsubreader::SUB_SAMI      :
  18.     return new TsubtitleParserSami(...);
  19.   case Tsubreader::SUB_VPLAYER   :
  20.     return new TsubtitleParserVplayer(...);
  21.   case Tsubreader::SUB_RT        :
  22.     return new TsubtitleParserRt(...);
  23.   case Tsubreader::SUB_SSA       :
  24.     return new TsubtitleParserSSA(..., isEmbedded);
  25.   case Tsubreader::SUB_DUNNOWHAT :
  26.     return new TsubtitleParserDunnowhat(...);
  27.   case Tsubreader::SUB_MPSUB     :
  28.     return new TsubtitleParserMPsub(...);
  29.   case Tsubreader::SUB_AQTITLE   :
  30.     return new TsubtitleParserAqt(...);
  31.   case Tsubreader::SUB_SUBVIEWER2:
  32.     return new TsubtitleParserSubviewer2(...);
  33.   case Tsubreader::SUB_SUBRIP09  :
  34.     return new TsubtitleParserSubrip09(...);
  35.   case Tsubreader::SUB_MPL2      :
  36.     return new TsubtitleParserMPL2(...);
  37.   default:
  38.     return NULL;
  39.   }
  40. }
  41.  
  42. TsubtitleParserBase *parser;
  43. parser = TsubtitleParserBase::getParser(
  44.   type, fps1000 / 1000.0, cfg, ffcfg, subs, utf8, true);
  45.  
  46. TsubtitlesTextpinText::~TsubtitlesTextpinText()
  47. {
  48.   if (parser) {
  49.     delete parser;
  50.   }
  51. }
  52.  
  53. A destructor is absent in TsubtitleParserBase. A virtual destructor is needed.
  54.  
  55. This suspicious code was found in ffdshow project by PVS-Studio static code analyzer.
  56. Warning message is:
  57. V599 The virtual destructor is not present, although the 'TsubtitleParserBase' class contains virtual functions. tsubtitlestextpintext.cpp 41
  58.  
  59. 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