[PATCH] Fixes fdo#64237 by modifying the underlyning string

Jean-Baptiste Faure jbf.faure at sud-ouest.org
Sun May 12 14:37:48 PDT 2013


Hi,

It seems that OpenID hates me and I can't connect to gerrit. So I answer
here. With the patch the bugdoc of fdo#64237 opens fine and it is
possible to scroll through the document without memory leak and crash.
I tested too the original document (not anonymized) and it works fine.

Thank you very much for this patch.

Best regards.
JBF
Le 12/05/2013 17:01, Arnaud Versini (via Code Review) a écrit :
> Hi,
> 
> I have submitted a patch for review:
> 
>     https://gerrit.libreoffice.org/3870
> 
> To pull it, you can do:
> 
>     git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/70/3870/1
> 
> Fixes fdo#64237 by modifying the underlyning string
> 
> Change-Id: I7d387e40464b53a55524bf950b8d413cf8468376
> ---
> M sw/source/core/text/guess.cxx
> 1 file changed, 4 insertions(+), 4 deletions(-)
> 
> 
> 
> diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
> index 637372f..03628da 100644
> --- a/sw/source/core/text/guess.cxx
> +++ b/sw/source/core/text/guess.cxx
> @@ -275,7 +275,7 @@
>                  aDebugString = rInf.GetTxt();
>  #endif
>  
> -                OUString rOldTxt = rInf.GetTxt();
> +                OUString& rOldTxt = const_cast<OUString&> (rInf.GetTxt());
>                  rOldTxt = rOldTxt.replaceAt( rInf.GetIdx() - 1, 1, aTxt );
>                  rInf.SetIdx( rInf.GetIdx() + nFieldDiff );
>              }
> @@ -487,9 +487,9 @@
>                      "I've got field trouble, part2!" );
>              nCutPos = nCutPos - nFieldDiff;
>  
> -            XubString& rOldTxt = (XubString&)rInf.GetTxt();
> -            rOldTxt.Erase( nOldIdx - 1, nFieldDiff + 1 );
> -            rOldTxt.Insert( cFldChr, nOldIdx - 1 );
> +            OUString& rOldTxt = const_cast<OUString&> (rInf.GetTxt());
> +            OUString aReplacement( cFldChr );
> +            rOldTxt = rOldTxt.replaceAt( nOldIdx - 1, nFieldDiff + 1, aReplacement);
>              rInf.SetIdx( nOldIdx );
>  
>  #if OSL_DEBUG_LEVEL > 0
> 


-- 
Seuls des formats ouverts peuvent assurer la pérennité de vos documents.


More information about the LibreOffice mailing list