unotools/source/config/configitem.cxx |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 4e257f0f8b62138ead3913f43350b7012799bcaa
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Wed Jul 3 14:51:35 2019 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Thu Jul 11 17:59:08 2019 +0200

    ConfigItem: use getTree also inside the RemoveChangesListener() method
    
    This is the only method which accesses the m_xHierarchyAccess member
    directly (except getTree() method). All other methods are using
    getTree() to access it.
    This direct member usage might be a problem when the code is run in
    fuzzing mode or the constructor is called with ReleaseTree mode.
    
    Change-Id: I7b5b91e63ac81d76028a098296fa306f154de53d
    Reviewed-on: https://gerrit.libreoffice.org/75042
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/unotools/source/config/configitem.cxx 
b/unotools/source/config/configitem.cxx
index 4af2eb3bc977..36cc9b68ed6a 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -532,16 +532,20 @@ bool ConfigItem::EnableNotification(const Sequence< 
OUString >& rNames,
 
 void ConfigItem::RemoveChangesListener()
 {
-    Reference<XChangesNotifier> xChgNot(m_xHierarchyAccess, UNO_QUERY);
-    if(xChgNot.is() && xChangeLstnr.is())
+    Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree();
+    if(xHierarchyAccess.is())
     {
-        try
-        {
-            xChgNot->removeChangesListener( xChangeLstnr );
-            xChangeLstnr = nullptr;
-        }
-        catch (const Exception&)
+        Reference<XChangesNotifier> xChgNot(xHierarchyAccess, UNO_QUERY);
+        if(xChgNot.is() && xChangeLstnr.is())
         {
+            try
+            {
+                xChgNot->removeChangesListener( xChangeLstnr );
+                xChangeLstnr = nullptr;
+            }
+            catch (const Exception&)
+            {
+            }
         }
     }
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to