New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class CompAccept which is inherited by class DocHtmlTable does not have a virtual destructor (Origin: bugzilla #588587) #3447

Closed
doxygen opened this Issue Jul 2, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@doxygen
Owner

doxygen commented Jul 2, 2018

status RESOLVED severity minor in component general for ---
Reported in version unspecified on platform Other
Assigned to: Dimitri van Heesch

On 2009-07-14 23:21:58 +0000, Ettl Martin wrote:

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 CompAccept
{
public:
CompAccept() { m_children.setAutoDelete(TRUE); }
void accept(T *obj, DocVisitor *v)
{
v->visitPre(obj);
QListIterator cli(m_children);
DocNode *n;
for (cli.toFirst();(n=cli.current());++cli) n->accept(v);
v->visitPost(obj);
}

protected:
QList 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

On 2009-07-15 18:21:02 +0000, Dimitri van Heesch wrote:

Thanks, this will be included in the next subversion update.

On 2009-08-20 10:13:15 +0000, Dimitri van Heesch wrote:

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).

@doxygen doxygen closed this Jul 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment