[Libreoffice-commits] core.git: vcl/jsdialog

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 23 13:47:53 UTC 2020


 vcl/jsdialog/jsdialogbuilder.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 107a9cf3560d712f8975af112f85ddaffe802647
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Tue Dec 22 16:40:20 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Wed Dec 23 14:47:13 2020 +0100

    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 at collabora.com>

diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 11a84bc8bc64..50954dcec727 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -107,7 +107,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)
@@ -401,15 +402,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")
         {


More information about the Libreoffice-commits mailing list