summaryrefslogtreecommitdiff
path: root/vcl/source/window/floatwin.cxx
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-12-06 16:19:35 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-12-06 17:35:38 +0530
commit20f985a4ac2dcc6d287c808b9dcfd055fcbabd91 (patch)
tree7d9cca27b1b94d87a617e02810217c35267c5232 /vcl/source/window/floatwin.cxx
parent98da350c7c9bcb96937f1397a34c2c68ede44011 (diff)
lokdialog: Show/Hide floating window on StateChangedType::Visible
In the earlier approach, other state change events like SetText are emitted which ends up in "else if !IsVisible()" block and tries to close the floating window before it's even registered. Interestingly, this is not the case every time. Anyhow, better safe than sorry. Guard the floating window 'created', 'close' callbacks in a StateChangeType::Visible event. Change-Id: Ib997e11fd4a0f50b8911e9891918112e8ff8ef85
Diffstat (limited to 'vcl/source/window/floatwin.cxx')
-rw-r--r--vcl/source/window/floatwin.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 59b12539e20a..d45707d60aec 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -603,11 +603,12 @@ void FloatingWindow::StateChanged( StateChangedType nType )
SystemWindow::StateChanged( nType );
- if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
+ VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier();
+ if (pParent && nType == StateChangedType::Visible)
{
- const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
- if (nType == StateChangedType::InitShow && IsVisible())
+ if (IsVisible())
{
+ const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
SetLOKNotifier(pNotifier);
std::vector<vcl::LOKPayloadItem> aItems;
@@ -619,7 +620,8 @@ void FloatingWindow::StateChanged( StateChangedType nType )
}
else if (!IsVisible())
{
- pNotifier->notifyWindow(GetLOKWindowId(), "close");
+ assert(GetLOKNotifier());
+ GetLOKNotifier()->notifyWindow(GetLOKWindowId(), "close");
ReleaseLOKNotifier();
}
}