Kaydet (Commit) 20f985a4 authored tarafından Pranav Kant's avatar Pranav Kant

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
üst 98da350c
......@@ -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();
}
}
......
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