diff options
-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&) + { + } } } } |