summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-05-15 11:46:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-15 15:40:25 +0200
commit3662b0c6b734f0725cecdc49b355d853287e2dd6 (patch)
tree14c86342588d16bf7fa68706d4841a4550c6ec2e
parentd935af8f3ef029e91f37605fa65b6ca51e4b1c55 (diff)
improve FmXGridPeer::dispose
(*) make the logic more explicit, the existing logic would try and do stuff at dispose() time that was potentially problematic (*) dont dispose the superclass in the middle, that means various things might go away before we're done with our own logic Change-Id: I9581ea5044b0e1822c235e85cf5827ff61ea7a3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115646 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--svx/source/fmcomp/fmgridif.cxx28
1 files changed, 26 insertions, 2 deletions
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 1893479a5d1c..64c9c6029f64 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -2043,7 +2043,6 @@ void FmXGridPeer::dispose()
m_aModifyListeners.disposeAndClear(aEvt);
m_aUpdateListeners.disposeAndClear(aEvt);
m_aContainerListeners.disposeAndClear(aEvt);
- VCLXWindow::dispose();
// release all interceptors
Reference< XDispatchProviderInterceptor > xInterceptor( m_xFirstDispatchInterceptor );
@@ -2063,7 +2062,32 @@ void FmXGridPeer::dispose()
}
DisConnectFromDispatcher();
- setRowSet(Reference< XRowSet > ());
+
+ // unregister all listeners
+ if (m_xCursor.is())
+ {
+ m_xCursor->removeRowSetListener(this);
+
+ Reference< XReset > xReset(m_xCursor, UNO_QUERY);
+ if (xReset.is())
+ xReset->removeResetListener(this);
+ Reference< XLoadable > xLoadable(m_xCursor, UNO_QUERY);
+ if (xLoadable.is())
+ xLoadable->removeLoadListener(this);
+ Reference< XPropertySet > xSet(m_xCursor, UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->removePropertyChangeListener(FM_PROP_ISMODIFIED, this);
+ xSet->removePropertyChangeListener(FM_PROP_ROWCOUNT, this);
+ }
+ m_xCursor.clear();
+ }
+
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
+ if (pGrid)
+ pGrid->setDataSource(Reference< XRowSet > ());
+
+ VCLXWindow::dispose();
}
// XContainer