GNOME Bugzilla – Bug 588587
Class CompAccept which is inherited by class DocHtmlTable does not have a virtual destructor
Last modified: 2012-11-18 11:11:10 UTC
Please describe the problem: Hello, i have checked the sources of the current version of doxygen with the static code analyis tool cppcheck (http://sourceforge.net/apps/trac/cppcheck/wiki). I found a missmatch in the inheritance structure. A destructor of a base class is not declared as virtual. This can lead to memory leaks. Steps to reproduce: 1. cppcheck -a -v -f -j2 -q doxygen-svn/src/ 2. Output: 3. [src/docparser.h:168]: (error) Class CompAccept which is inherited by class DocHtmlTable does not have a virtual destructor [src/docparser.h:168]: (error) Class CompAccept which is inherited by class DocSimpleSect does not have a virtual destructor Actual results: Expected results: no error Does this happen every time? yes Other information: Take a look at file docparser.h: [code] template<class T> class CompAccept { public: CompAccept() { m_children.setAutoDelete(TRUE); } void accept(T *obj, DocVisitor *v) { v->visitPre(obj); QListIterator<DocNode> cli(m_children); DocNode *n; for (cli.toFirst();(n=cli.current());++cli) n->accept(v); v->visitPost(obj); } protected: QList<DocNode> m_children; }; [/code] Indeed, it does not have a virtual destructor. This can easily avoided by declaring a virtual destructor: virtual ~CompAccept(){}; Best regards Ettl Martin
Thanks, this will be included in the next subversion update.
This bug was previously marked ASSIGNED, which means it should be fixed in doxygen version 1.6.0. Please verify if this is indeed the case and reopen the bug if you think it is not fixed (include any additional information that you think can be relevant).