diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-07-03 14:51:35 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-07-11 17:59:08 +0200 |
commit | 4e257f0f8b62138ead3913f43350b7012799bcaa (patch) | |
tree | 73cc77b7b2260a60d049a05172a996c90c70939c /unotools | |
parent | d99440ff16290a6727d71e27d3de1e96ef6701e2 (diff) |
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.zolnai@collabora.com>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/configitem.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
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&) + { + } } } } |