[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - vcl/source

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Fri Mar 25 08:28:11 UTC 2016


 vcl/source/window/toolbox2.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 91455345aa2a15309032b9b3c6e6c32f8701fb33
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Mar 25 01:29:08 2016 +0100

    tdf#94734: fix icon in sidebar disappears when changing font colour
    
    - properly initalize maImageOriginal along with maImage in various
      places
    - this is a regression from 27d94c482e82ea5d4f202109614c6fb3578fb0a4
    - that commit is mostly innocent in itself though, only exposing
      omissions from b8f21298288890d52c06fef6c84441634c56c986
    - having both maImage and maImageOriginal is extremely fragile as-is --
      likely I'd be helpful to have them private in ImplToolItem and then a
      SetImage accessor with a tristate eOriginal/eCached/eBoth enum
      parameter to prevent oversights like this in the future ...
    
    Change-Id: I294d7ed8e07be5cadec0ae251cc08c8d089bd059
    Reviewed-on: https://gerrit.libreoffice.org/23505
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 0c916f6..c3d1173 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -107,7 +107,8 @@ ImplToolItem::ImplToolItem()
 
 ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage,
                             ToolBoxItemBits nItemBits ) :
-    maImage( rImage )
+    maImage( rImage ),
+    maImageOriginal( rImage )
 {
     init(nItemId, nItemBits, false);
 }
@@ -122,6 +123,7 @@ ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const OUString& rText,
 ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage,
                             const OUString& rText, ToolBoxItemBits nItemBits ) :
     maImage( rImage ),
+    maImageOriginal( rImage ),
     maText( rText )
 {
     init(nItemId, nItemBits, false);
@@ -131,6 +133,7 @@ ImplToolItem::ImplToolItem( const ImplToolItem& rItem ) :
         mpWindow                ( rItem.mpWindow ),
         mpUserData              ( rItem.mpUserData ),
         maImage                 ( rItem.maImage ),
+        maImageOriginal         ( rItem.maImageOriginal ),
         mnImageAngle            ( rItem.mnImageAngle ),
         mbMirrorMode            ( rItem.mbMirrorMode ),
         maText                  ( rItem.maText ),
@@ -169,6 +172,7 @@ ImplToolItem& ImplToolItem::operator=( const ImplToolItem& rItem )
     mpWindow                = rItem.mpWindow;
     mpUserData              = rItem.mpUserData;
     maImage                 = rItem.maImage;
+    maImageOriginal         = rItem.maImageOriginal;
     mnImageAngle            = rItem.mnImageAngle;
     mbMirrorMode            = rItem.mbMirrorMode;
     maText                  = rItem.maText;
@@ -487,6 +491,7 @@ void ToolBox::InsertItem( const ResId& rResId, sal_uInt16 nPos )
         Bitmap aBmp = Bitmap( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *rResId.GetResMgr() ) );
         IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) );
         aItem.maImage = Image( aBmp, IMAGE_STDBTN_COLOR );
+        aItem.maImageOriginal = aItem.maImage;
         bImage = true;
     }
     if ( nObjMask & RSC_TOOLBOXITEM_IMAGE )
@@ -509,7 +514,10 @@ void ToolBox::InsertItem( const ResId& rResId, sal_uInt16 nPos )
 
     // if no image is loaded, try to load one from the image list
     if ( !bImage && aItem.mnId )
+    {
         aItem.maImage = maImageList.GetImage( aItem.mnId );
+        aItem.maImageOriginal = aItem.maImage;
+    }
 
     // if this is a ButtonItem, check ID
     bool bNewCalc;


More information about the Libreoffice-commits mailing list