After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 588587 - Class CompAccept which is inherited by class DocHtmlTable does not have a virtual destructor
Class CompAccept which is inherited by class DocHtmlTable does not have a vir...
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
unspecified
Other All
: Normal minor
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2009-07-14 23:21 UTC by Ettl Martin
Modified: 2012-11-18 11:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ettl Martin 2009-07-14 23:21:58 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
Comment 1 Dimitri van Heesch 2009-07-15 18:21:02 UTC
Thanks, this will be included in the next subversion update.
Comment 2 Dimitri van Heesch 2009-08-20 10:13:15 UTC
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).