summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2020-12-22 16:40:20 -0400
committerHenry Castro <hcastro@collabora.com>2021-01-19 02:20:08 +0100
commita8de3a3f83615cdbb113f7713227a64621e937d8 (patch)
treeb7393bf8ad4c8dbaaa19f0520cff580abed266c8
parente104272ac452d39a0f926f508051bd6af6613d24 (diff)
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 <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109203 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx9
1 files 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<weld::Dialog> 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")
{