lokit: double check for disposed windows & fix leak.
it seems we can get windows disposed before we get to the emission. <segv> vcl::Window::IsTracking() const vcl/source/window/window2.cxx:341 (anonymous namespace)::LOKPostAsyncEvent(void*, void*) sfx2/source/view/lokhelper.cxx:725 LokChartHelper::postMouseEvent(int, int, int, int, int, int, double, double) include/rtl/ref.hxx:112 SwXTextDocument::postMouseEvent(int, int, int, int, int, int) sw/source/uibase/uno/unotxdoc.cxx:3561 Change-Id: I93aea931dad1e7f43d3d610568424c53d2b22fbc Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127907
This commit is contained in:
@@ -679,9 +679,7 @@ namespace
|
||||
{
|
||||
std::unique_ptr<LOKAsyncEventData> pLOKEv(static_cast<LOKAsyncEventData*>(pEv));
|
||||
if (pLOKEv->mpWindow->isDisposed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int nView = SfxLokHelper::getView(nullptr);
|
||||
if (nView != pLOKEv->mnView)
|
||||
@@ -700,6 +698,9 @@ namespace
|
||||
if (!pFocusWindow)
|
||||
pFocusWindow = pLOKEv->mpWindow;
|
||||
|
||||
if (pLOKEv->mpWindow->isDisposed())
|
||||
return;
|
||||
|
||||
switch (pLOKEv->mnEvent)
|
||||
{
|
||||
case VclEventId::WindowKeyInput:
|
||||
@@ -708,11 +709,13 @@ namespace
|
||||
KeyEvent singlePress(pLOKEv->maKeyEvent.GetCharCode(),
|
||||
pLOKEv->maKeyEvent.GetKeyCode());
|
||||
for (sal_uInt16 i = 0; i <= nRepeat; ++i)
|
||||
pFocusWindow->KeyInput(singlePress);
|
||||
if (!pFocusWindow->isDisposed())
|
||||
pFocusWindow->KeyInput(singlePress);
|
||||
break;
|
||||
}
|
||||
case VclEventId::WindowKeyUp:
|
||||
pFocusWindow->KeyUp(pLOKEv->maKeyEvent);
|
||||
if (!pFocusWindow->isDisposed())
|
||||
pFocusWindow->KeyUp(pLOKEv->maKeyEvent);
|
||||
break;
|
||||
case VclEventId::WindowMouseButtonDown:
|
||||
pLOKEv->mpWindow->LogicMouseButtonDown(pLOKEv->maMouseEvent);
|
||||
|
||||
@@ -311,7 +311,7 @@ void Window::EndTracking( TrackingEventFlags nFlags )
|
||||
|
||||
bool Window::IsTracking() const
|
||||
{
|
||||
return (ImplGetSVData()->mpWinData->mpTrackWin == this);
|
||||
return mpWindowImpl && (ImplGetSVData()->mpWinData->mpTrackWin == this);
|
||||
}
|
||||
|
||||
void Window::StartAutoScroll( StartAutoScrollFlags nFlags )
|
||||
|
||||
Reference in New Issue
Block a user