[Libreoffice-bugs] [Bug 112388] Fraction::Fraction(Fraction const&) leaks memory
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Mon Sep 25 13:05:05 UTC 2017
https://bugs.documentfoundation.org/show_bug.cgi?id=112388
--- Comment #8 from Caolán McNamara <caolanm at redhat.com> ---
Well on the first one comment #2 showed that ScGridWindow was the owner of the
Fraction, so I just added fprintf(stderr, "ctor %p\n", this); to the
ScGridWindow ctor and ...dtor... to the dtor and quickly verified that the ctor
was called, but not its dtor. I checked that dispose was called and it was, so
something else had to be holding a reference to it that blocked the dtor from
getting called. I just visually inspected the ctor and checked aComboButton and
that seemed a good candidate, tweaked it as above and the ScGridWindow dtor got
called, so that was that.
On the other, a little harder, so I added static int foo to
tools/source/generic/fract.cxx added ctor/dtor fprintfs to the Fraction::Impl
ctor/dtor like above except ctor is fprintf(stderr, "ctor %p instance %d\n",
this, foo++); and started/closed calc, took the output, sorted and uniq -u it
by the printed address so (ctor with matching dtors are filtered out) and
there's a line left of the mismatched ctor without a dtor, took that leaked
address and its instance number from the output, then simply added if (foo ==
<thatnumber>) { something; } to the ctor and a breakpoint on that line, run
calc, and the backtrace then shows that the Fraction was created from the code
of commit number 2 of above.
Its rough and ready and unsophisticated but (as long as there's no timing or
threading involved) fairly simple to set up.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20170925/c9bfddc2/attachment.html>
More information about the Libreoffice-bugs
mailing list