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));
>   mod_it.value()->reset(toc.second);
> 
> 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.

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to