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

danlrobertson danlrobertson89 at gmail.com
Mon Jun 29 00:27:58 PDT 2015


 vcl/source/window/window.cxx |   62 ++++++++++++++++++++++++-------------------
 1 file changed, 36 insertions(+), 26 deletions(-)

New commits:
commit 9c330da6784fe7982e5dc78203f0c886054f0174
Author: danlrobertson <danlrobertson89 at gmail.com>
Date:   Sat Jun 27 00:40:54 2015 -0400

    tdf#91055 Pass by Address - lcl_createWindowInfo
    
    lcl_createWindowInfo now takes a pointer. In addition, a temporary
    pointer and if statement in the funcitons while loop was used
    in favor of a temporary pointer used throughout the function. There
    should be no side effects due to this change. The change is largely
    cosmetic.
    
    Change-Id: Ib5be6f792c4120c0e0b51562ba541b98a011c49e
    Reviewed-on: https://gerrit.libreoffice.org/16537
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b1f0eb8..6c221480 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -112,23 +112,33 @@ Window::Window( vcl::Window* pParent, const ResId& rResId )
 #if OSL_DEBUG_LEVEL > 0
 namespace
 {
-    OString lcl_createWindowInfo(const vcl::Window& i_rWindow)
-    {
-        // skip border windows, they don't carry information which helps diagnosing the problem
-        const vcl::Window* pWindow( &i_rWindow );
-        while ( pWindow && ( pWindow->GetType() == WINDOW_BORDERWINDOW ) )
-            pWindow = pWindow->GetWindow( GetWindowType::FirstChild );
-        if ( !pWindow )
-            pWindow = &i_rWindow;
-
-        OStringBuffer aErrorString;
-        aErrorString.append(' ');
-        aErrorString.append(typeid( *pWindow ).name());
-        aErrorString.append(" (");
-        aErrorString.append(OUStringToOString(pWindow->GetText(), RTL_TEXTENCODING_UTF8));
-        aErrorString.append(")");
-        return aErrorString.makeStringAndClear();
-    }
+     OString lcl_createWindowInfo(const vcl::Window* pWindow)
+     {
+         // skip border windows, they do not carry information that
+         // would help with diagnosing the problem
+         const vcl::Window* pTempWin( pWindow );
+         while ( pTempWin && pTempWin->GetType() == WINDOW_BORDERWINDOW ) {
+             pTempWin = pTempWin->GetWindow( GetWindowType::FirstChild );
+         }
+         // check if pTempWin is not null, otherwise use the
+         // original address
+         if ( pTempWin ) {
+             pWindow = pTempWin;
+         }
+
+         OStringBuffer aErrorString;
+         aErrorString.append(' ');
+         aErrorString.append(typeid( *pWindow ).name());
+         aErrorString.append("(");
+         aErrorString.append(
+                 OUStringToOString(
+                     pWindow->GetText(),
+                     RTL_TEXTENCODING_UTF8
+                     )
+                 );
+         aErrorString.append(")");
+         return aErrorString.makeStringAndClear();
+     }
 }
 #endif
 
@@ -260,12 +270,12 @@ void Window::dispose()
         if ( mpWindowImpl->mpFirstChild )
         {
             OStringBuffer aTempStr("Window (");
-            aTempStr.append(lcl_createWindowInfo(*this));
+            aTempStr.append(lcl_createWindowInfo(this));
             aTempStr.append(") with live children destroyed: ");
             pTempWin = mpWindowImpl->mpFirstChild;
             while ( pTempWin )
             {
-                aTempStr.append(lcl_createWindowInfo(*pTempWin));
+                aTempStr.append(lcl_createWindowInfo(pTempWin));
                 pTempWin = pTempWin->mpWindowImpl->mpNext;
             }
             OSL_FAIL( aTempStr.getStr() );
@@ -280,7 +290,7 @@ void Window::dispose()
                 if ( ImplIsRealParentPath( pTempWin ) )
                 {
                     bError = true;
-                    aErrorStr.append(lcl_createWindowInfo(*pTempWin));
+                    aErrorStr.append(lcl_createWindowInfo(pTempWin));
                 }
                 pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
             }
@@ -288,7 +298,7 @@ void Window::dispose()
             {
                 OStringBuffer aTempStr;
                 aTempStr.append("Window (");
-                aTempStr.append(lcl_createWindowInfo(*this));
+                aTempStr.append(lcl_createWindowInfo(this));
                 aTempStr.append(") with live SystemWindows destroyed: ");
                 aTempStr.append(aErrorStr.toString());
                 OSL_FAIL(aTempStr.getStr());
@@ -305,14 +315,14 @@ void Window::dispose()
             if ( ImplIsRealParentPath( pTempWin ) )
             {
                 bError = true;
-                aErrorStr.append(lcl_createWindowInfo(*pTempWin));
+                aErrorStr.append(lcl_createWindowInfo(pTempWin));
             }
             pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame;
         }
         if ( bError )
         {
             OStringBuffer aTempStr( "Window (" );
-            aTempStr.append(lcl_createWindowInfo(*this));
+            aTempStr.append(lcl_createWindowInfo(this));
             aTempStr.append(") with live SystemWindows destroyed: ");
             aTempStr.append(aErrorStr.toString());
             OSL_FAIL( aTempStr.getStr() );
@@ -322,12 +332,12 @@ void Window::dispose()
         if ( mpWindowImpl->mpFirstOverlap )
         {
             OStringBuffer aTempStr("Window (");
-            aTempStr.append(lcl_createWindowInfo(*this));
+            aTempStr.append(lcl_createWindowInfo(this));
             aTempStr.append(") with live SystemWindows destroyed: ");
             pTempWin = mpWindowImpl->mpFirstOverlap;
             while ( pTempWin )
             {
-                aTempStr.append(lcl_createWindowInfo(*pTempWin));
+                aTempStr.append(lcl_createWindowInfo(pTempWin));
                 pTempWin = pTempWin->mpWindowImpl->mpNext;
             }
             OSL_FAIL( aTempStr.getStr() );
@@ -348,7 +358,7 @@ void Window::dispose()
         if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
         {
             OStringBuffer aTempStr("Window (");
-            aTempStr.append(lcl_createWindowInfo(*this));
+            aTempStr.append(lcl_createWindowInfo(this));
             aTempStr.append(") still in TaskPanelList!");
             OSL_FAIL( aTempStr.getStr() );
             Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));   // abort in debug builds, this must be fixed!


More information about the Libreoffice-commits mailing list