[Libreoffice-commits] core.git: 4 commits - dbaccess/source fpicker/source include/vcl vcl/source

Caolán McNamara caolanm at redhat.com
Mon May 30 14:47:48 UTC 2016


 dbaccess/source/ui/app/AppDetailPageHelper.cxx |   14 +++++++++++---
 fpicker/source/office/iodlg.cxx                |    1 +
 include/vcl/toolbox.hxx                        |   11 -----------
 vcl/source/window/toolbox.cxx                  |    1 -
 vcl/source/window/toolbox2.cxx                 |   20 +++++---------------
 5 files changed, 17 insertions(+), 30 deletions(-)

New commits:
commit 5b342e10cbec2487085216346c055875a8eb9657
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 30 15:35:47 2016 +0100

    valgrind: Invalid read of size 8
    
    saw this in passing checking something else
    
    ==12972==    at 0x6DEF40B0: rtl::Reference<PlacesListBox>::get() const (ref.hxx:169)
    ==12972==    by 0x6DEEF221: VclPtr<PlacesListBox>::operator bool() const (vclptr.hxx:189)
    ==12972==    by 0x6DEED3DA: CustomContainer::GetFocus() (iodlg.cxx:429)
    ==12972==    by 0xD9EC83B: vcl::Window::CompatGetFocus() (window.cxx:3734)
    ==12972==    by 0xD93A604: vcl::Window::ImplGrabFocus(GetFocusFlags) (mouse.cxx:383)
    
    ...
    
    ==12972==  Address 0x2e4b4690 is 288 bytes inside a block of size 424 free'd
    ==12972==    at 0x4C2D22A: operator delete(void*) (vg_replace_malloc.c:576)
    ==12972==    by 0x6DED9F14: SvtFileDialog::dispose() (iodlg.cxx:518)
    ==12972==    by 0xDB04B1F: OutputDevice::disposeOnce() (outdev.cxx:161)
    ==12972==    by 0x6DED1954: VclPtr<SvtFileDialog_Base>::disposeAndClear() (vclptr.hxx:208)
    
    Change-Id: I702eab8dbcf07885e4a3415ace6706c25854174e

diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 26790b9..d658e92 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -516,6 +516,7 @@ void SvtFileDialog::dispose()
     }
 
     delete _pImp;
+    _pImp = nullptr;
     _pFileView.disposeAndClear();
     _pSplitter.disposeAndClear();
     _pContainer.disposeAndClear();
commit dd2a2abadd32423bb46f6163eb3525e448edbda0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 30 11:35:39 2016 +0100

    replace ImplConvertMenuString now
    
    Change-Id: Ib68b711fb98a917c2d40d0a659353e3983a3766e

diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 0ce31f3..c7b6a8d 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -180,7 +180,6 @@ private:
     using Window::ImplInvalidate;
     SAL_DLLPRIVATE void            ImplInvalidate( bool bNewCalc = false, bool bFullPaint = false );
     SAL_DLLPRIVATE void            ImplUpdateItem( sal_uInt16 nIndex = 0xFFFF );
-    SAL_DLLPRIVATE const OUString  ImplConvertMenuString( const OUString& rStr );
     SAL_DLLPRIVATE bool            ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat = false );
     SAL_DLLPRIVATE bool            ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel = false );
     SAL_DLLPRIVATE void            ImplChangeHighlight( ImplToolItem* pItem, bool bNoGrabFocus = false );
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 3b0cd61..0bbd7c4 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -335,11 +335,6 @@ bool ImplToolItem::IsItemHidden() const
     return ( meType == ToolBoxItemType::BUTTON && !mbVisible );
 }
 
-const OUString ToolBox::ImplConvertMenuString( const OUString& rStr )
-{
-    return MnemonicGenerator::EraseAllMnemonicChars(rStr);
-}
-
 void ToolBox::ImplInvalidate( bool bNewCalc, bool bFullPaint )
 {
     ImplUpdateInputEnable();
@@ -473,7 +468,7 @@ void ToolBox::InsertItem( const ResId& rResId )
     if ( nObjMask & RSC_TOOLBOXITEM_TEXT )
     {
         aItem.maText = ReadStringRes();
-        aItem.maText = ImplConvertMenuString( aItem.maText );
+        aItem.maText = MnemonicGenerator::EraseAllMnemonicChars(aItem.maText);
     }
     if ( nObjMask & RSC_TOOLBOXITEM_HELPTEXT )
         aItem.maHelpText = ReadStringRes();
@@ -566,7 +561,7 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, const OUStrin
 
     // create item and add to list
     mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(),
-                             ImplToolItem( nItemId, rImage, ImplConvertMenuString( rText ), nBits ) );
+                             ImplToolItem( nItemId, rImage, MnemonicGenerator::EraseAllMnemonicChars(rText), nBits ) );
     SetItemImage(nItemId, rImage);
     mpData->ImplClearLayoutData();
 
@@ -585,7 +580,7 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText, ToolBoxItem
 
     // create item and add to list
     mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(),
-                             ImplToolItem( nItemId, ImplConvertMenuString( rText ), nBits ) );
+                             ImplToolItem( nItemId, MnemonicGenerator::EraseAllMnemonicChars(rText), nBits ) );
     mpData->ImplClearLayoutData();
 
     ImplInvalidate( true );
@@ -1266,7 +1261,7 @@ void ToolBox::SetItemText( sal_uInt16 nItemId, const OUString& rText )
              ((meButtonType != ButtonType::SYMBOLONLY) || !pItem->maImage) )
         {
             long nOldWidth = GetCtrlTextWidth( pItem->maText );
-            pItem->maText = ImplConvertMenuString( rText );
+            pItem->maText = MnemonicGenerator::EraseAllMnemonicChars(rText);
             mpData->ImplClearLayoutData();
             if ( nOldWidth != GetCtrlTextWidth( pItem->maText ) )
                 ImplInvalidate( true );
@@ -1274,7 +1269,7 @@ void ToolBox::SetItemText( sal_uInt16 nItemId, const OUString& rText )
                 ImplUpdateItem( nPos );
         }
         else
-            pItem->maText = ImplConvertMenuString( rText );
+            pItem->maText = MnemonicGenerator::EraseAllMnemonicChars(rText);
 
         // Notify button changed event to prepare accessibility bridge
         CallEventListeners( VCLEVENT_TOOLBOX_BUTTONSTATECHANGED, reinterpret_cast< void* >( nPos ) );
commit 33a49289dfdba94c92dfd466635c4c663e916848
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 30 11:30:52 2016 +0100

    move the one single use of EnableMenuStrings to its call site
    
    Change-Id: Ie5087f564c024cae526757ed1445c97113e8a68e

diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 4c1a541..fb4564f 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -48,6 +48,7 @@
 #include <com/sun/star/ucb/XCommandProcessor.hpp>
 #include <com/sun/star/ucb/Command.hpp>
 #include <com/sun/star/util/XCloseable.hpp>
+#include <comphelper/string.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include "AppView.hxx"
 #include "dbaccess_helpid.hrc"
@@ -197,7 +198,6 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
     m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,m_aMenu->GetItemText(SID_DB_APP_DISABLE_PREVIEW),ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
     m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
     m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
-    m_aTBPreview->EnableMenuStrings();
     m_aTBPreview->Enable();
 
     m_aPreview->SetHelpId(HID_APP_VIEW_PREVIEW_1);
@@ -957,6 +957,14 @@ bool OAppDetailPageHelper::isPreviewEnabled()
     return m_ePreviewMode != E_PREVIEWNONE;
 }
 
+namespace
+{
+    OUString stripTrailingDots(const OUString& rStr)
+    {
+        return comphelper::string::stripEnd(rStr, '.');
+    }
+}
+
 void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
 {
     if ( m_ePreviewMode != _eMode || _bForce )
@@ -983,7 +991,7 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
         }
 
         m_aMenu->CheckItem(nSelectedAction);
-        m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, m_aMenu->GetItemText(nSelectedAction));
+        m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(m_aMenu->GetItemText(nSelectedAction)));
         Resize();
 
         // simulate a selectionChanged event at the controller, to force the preview to be updated
@@ -1168,7 +1176,7 @@ IMPL_LINK_NOARG_TYPED(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void)
     m_aTBPreview->SetItemDown( SID_DB_APP_DISABLE_PREVIEW, false);
     if ( nSelectedAction )
     {
-        m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, aMenu->GetItemText(nSelectedAction));
+        m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aMenu->GetItemText(nSelectedAction)));
         Resize();
         getBorderWin().getView()->getAppController().executeChecked(nSelectedAction,Sequence<PropertyValue>());
     }
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index cc3704c..0ce31f3 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -136,7 +136,6 @@ private:
                         mbCustomize:1,
                         mbCustomizeMode:1,
                         mbDragging:1,
-                        mbMenuStrings:1,
                         mbIsShift:1,
                         mbIsKeyEvent:1,
                         mbChangingHighlight:1,
@@ -452,8 +451,6 @@ public:
     // read configuration to determine locking behaviour
     static bool         AlwaysLocked();
 
-    void                EnableMenuStrings( bool bEnable = true ) { mbMenuStrings = bEnable; }
-
     void                SetOutStyle( sal_uInt16 nNewStyle );
     sal_uInt16          GetOutStyle() const { return mnOutStyle; }
 
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 3cb978a..7327a5e 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1373,7 +1373,6 @@ void ToolBox::ImplInitToolBoxData()
     mbCustomize       = false;
     mbCustomizeMode   = false;
     mbDragging        = false;
-    mbMenuStrings     = false;
     mbIsShift         = false;
     mbIsKeyEvent = false;
     mbChangingHighlight = false;
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 7a93e50..3b0cd61 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -20,7 +20,6 @@
 #include "sal/config.h"
 
 #include <comphelper/processfactory.hxx>
-#include <comphelper/string.hxx>
 #include <tools/debug.hxx>
 #include <tools/rc.h>
 
@@ -338,11 +337,7 @@ bool ImplToolItem::IsItemHidden() const
 
 const OUString ToolBox::ImplConvertMenuString( const OUString& rStr )
 {
-    OUString aCvtStr( rStr );
-    if ( mbMenuStrings )
-        aCvtStr = comphelper::string::stripEnd(aCvtStr, '.');
-    aCvtStr = MnemonicGenerator::EraseAllMnemonicChars( aCvtStr );
-    return aCvtStr;
+    return MnemonicGenerator::EraseAllMnemonicChars(rStr);
 }
 
 void ToolBox::ImplInvalidate( bool bNewCalc, bool bFullPaint )
commit e8dff0479e568c6d8de517782ac22ba987f81da1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 30 11:32:28 2016 +0100

    SetFloatingLines is now unused
    
    Change-Id: I867633d7d19dd03b8bd2771f1eaac897ef97b5bc

diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 408964f..cc3704c 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -442,7 +442,6 @@ public:
     // computes the smallest useful size when docked, ie with the first item visible only (+drag area and menu button)
     Size                CalcMinimumWindowSizePixel() const;
 
-    void                SetFloatingLines( sal_uInt16 nFloatLines );
     sal_uInt16          GetFloatingLines() const;
 
     void                SetStyle( WinBits nNewStyle );
@@ -536,12 +535,6 @@ inline Size ToolBox::CalcWindowSizePixel() const
     return CalcWindowSizePixel( mnLines );
 }
 
-
-inline void ToolBox::SetFloatingLines( sal_uInt16 nNewLines )
-{
-    mnFloatLines = nNewLines;
-}
-
 inline sal_uInt16 ToolBox::GetFloatingLines() const
 {
     return mnFloatLines;


More information about the Libreoffice-commits mailing list