diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 19:16:08 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 19:33:34 +0100 |
commit | e33d74ff2ef2493b9de558b033c2d05b6ce97069 (patch) | |
tree | 93c2a06f55fbda5f5050f71e3554f233430f44bd /tools | |
parent | ece63f8914367a16fda83a32986bd4a5e4270f2d (diff) |
Make ErrorContext includers happier.
Unclear that it's a great plan to have a circular tools <-> vcl
dependency like this, but it pre-dates history apparently.
Change-Id: I7a666dbde9ec7cc29a4e260e2012cca4a26b0b29
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/ref/errinf.cxx | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx index babe0acd776f..688cd93109c3 100644 --- a/tools/source/ref/errinf.cxx +++ b/tools/source/ref/errinf.cxx @@ -186,22 +186,32 @@ static void aDspFunc(const OUString &rErr, const OUString &rAction) OSL_FAIL(aErr.getStr()); } +// FIXME: this is a truly horrible reverse dependency on VCL +#include <vcl/window.hxx> +struct ErrorContextImpl +{ + ErrorContext* pNext; + VclPtr<vcl::Window> pWin; +}; + ErrorContext::ErrorContext(vcl::Window *pWinP) { + pImpl = new ErrorContextImpl(); EDcrData *pData=EDcrData::GetData(); - ErrorContext *&pHdl=pData->pFirstCtx; - pWin=pWinP; - pNext=pHdl; - pHdl=this; + ErrorContext *&pHdl = pData->pFirstCtx; + pImpl->pWin = pWinP; + pImpl->pNext = pHdl; + pHdl = this; } ErrorContext::~ErrorContext() { ErrorContext **ppCtx=&(EDcrData::GetData()->pFirstCtx); while(*ppCtx && *ppCtx!=this) - ppCtx=&((*ppCtx)->pNext); + ppCtx=&((*ppCtx)->pImpl->pNext); if(*ppCtx) - *ppCtx=(*ppCtx)->pNext; + *ppCtx=(*ppCtx)->pImpl->pNext; + delete pImpl; } ErrorContext *ErrorContext::GetContext() @@ -230,6 +240,11 @@ ErrorHandler::~ErrorHandler() delete pImpl; } +vcl::Window* ErrorContext::GetParent() +{ + return pImpl ? pImpl->pWin.get() : NULL; +} + void ErrorHandler::RegisterDisplay(WindowDisplayErrorFunc *aDsp) { EDcrData *pData=EDcrData::GetData(); @@ -276,7 +291,7 @@ sal_uInt16 ErrorHandler::HandleError_Impl( pCtx->GetString(pInfo->GetErrorCode(), aAction); vcl::Window *pParent=0; // Remove parent from context - for(;pCtx;pCtx=pCtx->pNext) + for(;pCtx;pCtx=pCtx->pImpl->pNext) if(pCtx->GetParent()) { pParent=pCtx->GetParent(); |