[Libreoffice-commits] core.git: editeng/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Tue May 28 08:22:34 UTC 2019


 editeng/source/editeng/editdoc.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit e8f4bf9df5b6a9b24256d00462d94c430e319134
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Mon May 27 20:52:18 2019 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Tue May 28 10:21:53 2019 +0200

    Add comment about this "weird assignment" in editdoc
    
    See http://document-foundation-mail-archive.969070.n3.nabble.com/Fishy-assignment-in-editdoc-editeng-td4262109.html
    
    Remove the previous comment less clear
    
    Change-Id: I06b0bc3254068d58146d9582c2b69afbadbe56ee
    Reviewed-on: https://gerrit.libreoffice.org/73062
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Jenkins

diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 63990e4c9121..73a356054741 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2025,10 +2025,12 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S
     if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_RELIEF ) == SfxItemState::SET ) )
         rFont.SetRelief( rSet.Get( EE_CHAR_RELIEF ).GetValue() );
 
-    // If comparing the entire font, or if checking before each alteration
-    // whether the value changes, remains relatively the same thing.
-    // So possible one MakeUniqFont more in the font, but as a result a quicker
-    // abortion of the query, or one must each time check bChanged.
+    // Operator == compares the individual members of the font if the impl pointer is
+    // not equal. If all members are the same, this assignment makes
+    // sure that both also point to the same internal instance of the font.
+    // To avoid this assignment, you would need to check in
+    // every if statement above whether or not the new value differs from the
+    // old value before making an assignment.
     if ( rFont == aPrevFont  )
         rFont = aPrevFont;  // => The same ImpPointer for IsSameInstance
 }


More information about the Libreoffice-commits mailing list