From a8de3a3f83615cdbb113f7713227a64621e937d8 Mon Sep 17 00:00:00 2001 From: Henry Castro Date: Tue, 22 Dec 2020 16:40:20 -0400 Subject: jsdialog: fix disable idle notify There is a possible crash due to nullptr deference Change-Id: I3e2034ad89832eec61f1d6910a5ffd34c56df6a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108224 Tested-by: Jenkins Reviewed-by: Henry Castro Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109203 Tested-by: Jenkins CollaboraOffice --- vcl/jsdialog/jsdialogbuilder.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 0cd9661b76ec..ceff10569e51 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -142,7 +142,8 @@ void JSDialogNotifyIdle::sendClose() { send(generateCloseMessage()); } void JSDialogSender::notifyDialogState(bool bForce) { - if (mpIdleNotify->getNotifierWindow()->IsDisableIdleNotify()) + auto aNotifierWnd = mpIdleNotify->getNotifierWindow(); + if (aNotifierWnd && aNotifierWnd->IsDisableIdleNotify()) return; if (bForce) @@ -434,15 +435,15 @@ std::unique_ptr JSInstanceBuilder::weld_dialog(const OString& id, m_xBuilder->drop_ownership(pDialog); m_bHasTopLevelDialog = true; + if (id == "MacroSelectorDialog") + pDialog->SetDisableIdleNotify(true); + pRet.reset(pDialog ? new JSDialog(m_aOwnedToplevel, m_aOwnedToplevel, pDialog, this, false, m_sTypeOfJSON) : nullptr); RememberWidget("__DIALOG__", pRet.get()); - if (id == "MacroSelectorDialog") - pDialog->SetDisableIdleNotify(true); - const vcl::ILibreOfficeKitNotifier* pNotifier = pDialog->GetLOKNotifier(); if (pNotifier && id != "MacroSelectorDialog") { -- cgit