Valgrind "definitely lost" backtrace
sanda at lyx.org
Fri Feb 14 13:55:56 UTC 2020
On Thu, Feb 13, 2020 at 09:58:15PM -0500, Scott Kostyshak wrote:
> The corresponding line of TocModel.cpp:362 is the line with "new" below:
> // First, fill in the toc models.
> iterator mod_it = models_.find(type);
> if (mod_it == models_.end())
> mod_it = models_.insert(type, new TocModel(this));
> Note that models_ is declared as follow:
> QHash<QString, TocModel *> models_;
> Is it the responsibility of the QHash's destructor to call delete on all
> of the TocModel * of its elements? Where is the problem likely to be?
Without looking how insert() is defined my guess is that it just copies
the whole object created by new TocModel(this) (not using pointer to it),
so once you leave this statement there is no handle for temporarily created
object and mem leak occurs.
More information about the lyx-devel