Re: Win32 Crash on Backspace


Subject: Re: Win32 Crash on Backspace
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Sat Jul 07 2001 - 09:01:31 CDT


On Sat, 7 Jul 2001, [ISO-8859-1] Joaquín Cuenca Abela wrote:

> On 06 Jul 2001 23:05:31 -0500, Michael D. Pritchett wrote:
> > Memory leaks for Win32 are evaporating. I am seeing a few complaints at
> > pp_Property.cpp(450) for the MSVC stuff. This is much better than
> > it was previously, and I thank all that have worked on reducing those
> > pesky memory bugs to date.
> >
> > Just a quick note on the crash. The lastest Win32 build crashes at
> > pf_Fragments.cpp at Line 194 with an assertion failure claiming
> > !areFragsDirty() when I type a character and then backspace.
>
> interesting... so after all, we were using this method without having
> all the frags clean
>
> Just change
>
> UT_ASSERT(!areFragsDirty())
>
> by
>
> if (areFragsDirty())
> cleanFragsConst();

Very interesting! I'd like to trace through to find the cause of this but
Joaquin's right. This is the safe thing to do and add very little overhead
to the method. Please do this.

>
> PS: Can we erase "void cleanFragsConst() const" and the utility method
> that is just above this one, make pf_Fragments::m_vecFrags,
> pf_Fragments::m_pLastFragClean & pf_Frag::m_docPos mutable and turn
> "void pf_Fragments::cleanFrags(pf_Frag*)" & "void
> pf_Frags::setPos(PT_DocPosition)" into const method's, please (all these
> variables are only there to cache values, so imo a change in these
> variables don't change the logical state of the related objects)?
>

I think so. I just learnt about mutable member variables. I don't know if
these are allowed within the AbiWord C++ guidelines. I do know that
cleanFrags MUST be a const function otherwise all sorts of other methods
won't compile.

Anyway your proposal is much better C++.

> If you do that, just 's/cleanFragsConst/cleanFrags/g;' at
> text/ptbl/xp/*.cpp
>

Yep.

Cheers

Martin

PS. Could someone else do this? It's a pain for me to access CVS for the
next 2 days.



This archive was generated by hypermail 2b25 : Sat Jul 07 2001 - 09:01:45 CDT