Kaydet (Commit) 9c330da6 authored tarafından danlrobertson's avatar danlrobertson Kaydeden (comit) Noel Grandin

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/16537Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 497c5898
...@@ -112,23 +112,33 @@ Window::Window( vcl::Window* pParent, const ResId& rResId ) ...@@ -112,23 +112,33 @@ Window::Window( vcl::Window* pParent, const ResId& rResId )
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
namespace namespace
{ {
OString lcl_createWindowInfo(const vcl::Window& i_rWindow) OString lcl_createWindowInfo(const vcl::Window* pWindow)
{ {
// skip border windows, they don't carry information which helps diagnosing the problem // skip border windows, they do not carry information that
const vcl::Window* pWindow( &i_rWindow ); // would help with diagnosing the problem
while ( pWindow && ( pWindow->GetType() == WINDOW_BORDERWINDOW ) ) const vcl::Window* pTempWin( pWindow );
pWindow = pWindow->GetWindow( GetWindowType::FirstChild ); while ( pTempWin && pTempWin->GetType() == WINDOW_BORDERWINDOW ) {
if ( !pWindow ) pTempWin = pTempWin->GetWindow( GetWindowType::FirstChild );
pWindow = &i_rWindow; }
// check if pTempWin is not null, otherwise use the
OStringBuffer aErrorString; // original address
aErrorString.append(' '); if ( pTempWin ) {
aErrorString.append(typeid( *pWindow ).name()); pWindow = pTempWin;
aErrorString.append(" ("); }
aErrorString.append(OUStringToOString(pWindow->GetText(), RTL_TEXTENCODING_UTF8));
aErrorString.append(")"); OStringBuffer aErrorString;
return aErrorString.makeStringAndClear(); aErrorString.append(' ');
} aErrorString.append(typeid( *pWindow ).name());
aErrorString.append("(");
aErrorString.append(
OUStringToOString(
pWindow->GetText(),
RTL_TEXTENCODING_UTF8
)
);
aErrorString.append(")");
return aErrorString.makeStringAndClear();
}
} }
#endif #endif
...@@ -260,12 +270,12 @@ void Window::dispose() ...@@ -260,12 +270,12 @@ void Window::dispose()
if ( mpWindowImpl->mpFirstChild ) if ( mpWindowImpl->mpFirstChild )
{ {
OStringBuffer aTempStr("Window ("); OStringBuffer aTempStr("Window (");
aTempStr.append(lcl_createWindowInfo(*this)); aTempStr.append(lcl_createWindowInfo(this));
aTempStr.append(") with live children destroyed: "); aTempStr.append(") with live children destroyed: ");
pTempWin = mpWindowImpl->mpFirstChild; pTempWin = mpWindowImpl->mpFirstChild;
while ( pTempWin ) while ( pTempWin )
{ {
aTempStr.append(lcl_createWindowInfo(*pTempWin)); aTempStr.append(lcl_createWindowInfo(pTempWin));
pTempWin = pTempWin->mpWindowImpl->mpNext; pTempWin = pTempWin->mpWindowImpl->mpNext;
} }
OSL_FAIL( aTempStr.getStr() ); OSL_FAIL( aTempStr.getStr() );
...@@ -280,7 +290,7 @@ void Window::dispose() ...@@ -280,7 +290,7 @@ void Window::dispose()
if ( ImplIsRealParentPath( pTempWin ) ) if ( ImplIsRealParentPath( pTempWin ) )
{ {
bError = true; bError = true;
aErrorStr.append(lcl_createWindowInfo(*pTempWin)); aErrorStr.append(lcl_createWindowInfo(pTempWin));
} }
pTempWin = pTempWin->mpWindowImpl->mpNextOverlap; pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
} }
...@@ -288,7 +298,7 @@ void Window::dispose() ...@@ -288,7 +298,7 @@ void Window::dispose()
{ {
OStringBuffer aTempStr; OStringBuffer aTempStr;
aTempStr.append("Window ("); aTempStr.append("Window (");
aTempStr.append(lcl_createWindowInfo(*this)); aTempStr.append(lcl_createWindowInfo(this));
aTempStr.append(") with live SystemWindows destroyed: "); aTempStr.append(") with live SystemWindows destroyed: ");
aTempStr.append(aErrorStr.toString()); aTempStr.append(aErrorStr.toString());
OSL_FAIL(aTempStr.getStr()); OSL_FAIL(aTempStr.getStr());
...@@ -305,14 +315,14 @@ void Window::dispose() ...@@ -305,14 +315,14 @@ void Window::dispose()
if ( ImplIsRealParentPath( pTempWin ) ) if ( ImplIsRealParentPath( pTempWin ) )
{ {
bError = true; bError = true;
aErrorStr.append(lcl_createWindowInfo(*pTempWin)); aErrorStr.append(lcl_createWindowInfo(pTempWin));
} }
pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame; pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame;
} }
if ( bError ) if ( bError )
{ {
OStringBuffer aTempStr( "Window (" ); OStringBuffer aTempStr( "Window (" );
aTempStr.append(lcl_createWindowInfo(*this)); aTempStr.append(lcl_createWindowInfo(this));
aTempStr.append(") with live SystemWindows destroyed: "); aTempStr.append(") with live SystemWindows destroyed: ");
aTempStr.append(aErrorStr.toString()); aTempStr.append(aErrorStr.toString());
OSL_FAIL( aTempStr.getStr() ); OSL_FAIL( aTempStr.getStr() );
...@@ -322,12 +332,12 @@ void Window::dispose() ...@@ -322,12 +332,12 @@ void Window::dispose()
if ( mpWindowImpl->mpFirstOverlap ) if ( mpWindowImpl->mpFirstOverlap )
{ {
OStringBuffer aTempStr("Window ("); OStringBuffer aTempStr("Window (");
aTempStr.append(lcl_createWindowInfo(*this)); aTempStr.append(lcl_createWindowInfo(this));
aTempStr.append(") with live SystemWindows destroyed: "); aTempStr.append(") with live SystemWindows destroyed: ");
pTempWin = mpWindowImpl->mpFirstOverlap; pTempWin = mpWindowImpl->mpFirstOverlap;
while ( pTempWin ) while ( pTempWin )
{ {
aTempStr.append(lcl_createWindowInfo(*pTempWin)); aTempStr.append(lcl_createWindowInfo(pTempWin));
pTempWin = pTempWin->mpWindowImpl->mpNext; pTempWin = pTempWin->mpWindowImpl->mpNext;
} }
OSL_FAIL( aTempStr.getStr() ); OSL_FAIL( aTempStr.getStr() );
...@@ -348,7 +358,7 @@ void Window::dispose() ...@@ -348,7 +358,7 @@ void Window::dispose()
if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) ) if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
{ {
OStringBuffer aTempStr("Window ("); OStringBuffer aTempStr("Window (");
aTempStr.append(lcl_createWindowInfo(*this)); aTempStr.append(lcl_createWindowInfo(this));
aTempStr.append(") still in TaskPanelList!"); aTempStr.append(") still in TaskPanelList!");
OSL_FAIL( aTempStr.getStr() ); OSL_FAIL( aTempStr.getStr() );
Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed! Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment