summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-07-09 12:58:11 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-07-09 17:15:27 +0000
commit6a2643b92d05a51ef241aeb1e4d5948647e646ef (patch)
tree775acd323e2fceacd65edf5f3d4326f053bd4344
parent23e31c4cba59f8de2765a6011915b8da9696807e (diff)
tdf#92611 - unwind UNO lifecycle snafu.
Introduced in commit 1c4025babd7037a3292aa530c7d45ab8d6ef6dcb. Was using UNO reference counting on a member allocated as part of another object. Change-Id: Ic86b2aa30359dc202c8bc2f1a0de476167a1e561 Reviewed-on: https://gerrit.libreoffice.org/16889 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--extensions/source/bibliography/bibview.cxx6
-rw-r--r--extensions/source/bibliography/general.cxx7
-rw-r--r--extensions/source/bibliography/general.hxx4
3 files changed, 10 insertions, 7 deletions
diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx
index d1a8b95642de..23d4186f7537 100644
--- a/extensions/source/bibliography/bibview.cxx
+++ b/extensions/source/bibliography/bibview.cxx
@@ -66,7 +66,7 @@ namespace bib
void BibView::dispose()
{
- BibGeneralPage* pGeneralPage = m_pGeneralPage;
+ VclPtr<BibGeneralPage> pGeneralPage = m_pGeneralPage;
m_pGeneralPage.clear();
pGeneralPage->CommitActiveControl();
@@ -102,6 +102,7 @@ namespace bib
m_aFormControlContainer.disconnectForm();
pGeneralPage->RemoveListeners();
+ pGeneralPage.disposeAndClear();
m_xGeneralPage = NULL;
BibWindow::dispose();
}
@@ -116,11 +117,12 @@ namespace bib
{
m_pGeneralPage->Hide();
m_pGeneralPage->RemoveListeners();
+ m_pGeneralPage.disposeAndClear();
m_xGeneralPage = 0;
}
m_pGeneralPage = VclPtr<BibGeneralPage>::Create( this, m_pDatMan );
- m_xGeneralPage = &m_pGeneralPage->GetFocusListener();
+ m_xGeneralPage = m_pGeneralPage->GetFocusListener().get();
m_pGeneralPage->Show();
if( HasFocus() )
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index f84ab5855411..19e816894993 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -168,7 +168,7 @@ void BibPosListener::disposing(const lang::EventObject& /*Source*/) throw( uno::
BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan):
BibTabPage(pParent, "GeneralPage", "modules/sbibliography/ui/generalpage.ui"),
sErrorPrefix(BIB_RESSTR(ST_ERROR_PREFIX)),
- maBibGeneralPageFocusListener(this),
+ mxBibGeneralPageFocusListener(new BibGeneralPageFocusListener(this)),
pDatMan(pMan)
{
get(pIdentifierFT, "shortname");
@@ -387,6 +387,7 @@ void BibGeneralPage::dispose()
pCustom4FT.clear();
pCustom5FT.clear();
for (auto & a: aFixedTexts) a.clear();
+ mxBibGeneralPageFocusListener.clear();
BibTabPage::dispose();
}
@@ -397,7 +398,7 @@ void BibGeneralPage::RemoveListeners()
if(aControls[i].is())
{
uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY );
- xCtrWin->removeFocusListener( &maBibGeneralPageFocusListener );
+ xCtrWin->removeFocusListener( mxBibGeneralPageFocusListener.get() );
aControls[i] = 0;
}
}
@@ -488,7 +489,7 @@ uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl(
// Peer as Child to the FrameWindow
xCtrlContnr->addControl(rName, xControl);
uno::Reference< awt::XWindow > xCtrWin(xControl, UNO_QUERY );
- xCtrWin->addFocusListener( &maBibGeneralPageFocusListener );
+ xCtrWin->addFocusListener( mxBibGeneralPageFocusListener.get() );
rIndex = -1; // -> implies, that not found
for(sal_uInt16 i = 0; i < FIELD_COUNT; i++)
if(!aControls[i].is())
diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx
index e566c9f15e81..af34aa6d6b6f 100644
--- a/extensions/source/bibliography/general.hxx
+++ b/extensions/source/bibliography/general.hxx
@@ -127,7 +127,7 @@ class BibGeneralPage: public BibTabPage
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >
xPosListener;
- BibGeneralPageFocusListener maBibGeneralPageFocusListener;
+ rtl::Reference<BibGeneralPageFocusListener> mxBibGeneralPageFocusListener;
BibDataManager* pDatMan;
@@ -164,7 +164,7 @@ public:
virtual bool HandleShortCutKey( const KeyEvent& rKeyEvent ) SAL_OVERRIDE; // returns true, if key was handled
- inline BibGeneralPageFocusListener& GetFocusListener() { return maBibGeneralPageFocusListener; }
+ inline rtl::Reference<BibGeneralPageFocusListener> GetFocusListener() { return mxBibGeneralPageFocusListener; }
void focusGained(const css::awt::FocusEvent& rEvent) throw( css::uno::RuntimeException, std::exception );
void focusLost(const css::awt::FocusEvent& rEvent) throw( css::uno::RuntimeException, std::exception );