Kaydet (Commit) 6a2643b9 authored tarafından Michael Meeks's avatar Michael Meeks

tdf#92611 - unwind UNO lifecycle snafu.

Introduced in commit 1c4025ba.
Was using UNO reference counting on a member allocated as part
of another object.

Change-Id: Ic86b2aa30359dc202c8bc2f1a0de476167a1e561
Reviewed-on: https://gerrit.libreoffice.org/16889Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 23e31c4c
...@@ -66,7 +66,7 @@ namespace bib ...@@ -66,7 +66,7 @@ namespace bib
void BibView::dispose() void BibView::dispose()
{ {
BibGeneralPage* pGeneralPage = m_pGeneralPage; VclPtr<BibGeneralPage> pGeneralPage = m_pGeneralPage;
m_pGeneralPage.clear(); m_pGeneralPage.clear();
pGeneralPage->CommitActiveControl(); pGeneralPage->CommitActiveControl();
...@@ -102,6 +102,7 @@ namespace bib ...@@ -102,6 +102,7 @@ namespace bib
m_aFormControlContainer.disconnectForm(); m_aFormControlContainer.disconnectForm();
pGeneralPage->RemoveListeners(); pGeneralPage->RemoveListeners();
pGeneralPage.disposeAndClear();
m_xGeneralPage = NULL; m_xGeneralPage = NULL;
BibWindow::dispose(); BibWindow::dispose();
} }
...@@ -116,11 +117,12 @@ namespace bib ...@@ -116,11 +117,12 @@ namespace bib
{ {
m_pGeneralPage->Hide(); m_pGeneralPage->Hide();
m_pGeneralPage->RemoveListeners(); m_pGeneralPage->RemoveListeners();
m_pGeneralPage.disposeAndClear();
m_xGeneralPage = 0; m_xGeneralPage = 0;
} }
m_pGeneralPage = VclPtr<BibGeneralPage>::Create( this, m_pDatMan ); m_pGeneralPage = VclPtr<BibGeneralPage>::Create( this, m_pDatMan );
m_xGeneralPage = &m_pGeneralPage->GetFocusListener(); m_xGeneralPage = m_pGeneralPage->GetFocusListener().get();
m_pGeneralPage->Show(); m_pGeneralPage->Show();
if( HasFocus() ) if( HasFocus() )
......
...@@ -168,7 +168,7 @@ void BibPosListener::disposing(const lang::EventObject& /*Source*/) throw( uno:: ...@@ -168,7 +168,7 @@ void BibPosListener::disposing(const lang::EventObject& /*Source*/) throw( uno::
BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan): BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan):
BibTabPage(pParent, "GeneralPage", "modules/sbibliography/ui/generalpage.ui"), BibTabPage(pParent, "GeneralPage", "modules/sbibliography/ui/generalpage.ui"),
sErrorPrefix(BIB_RESSTR(ST_ERROR_PREFIX)), sErrorPrefix(BIB_RESSTR(ST_ERROR_PREFIX)),
maBibGeneralPageFocusListener(this), mxBibGeneralPageFocusListener(new BibGeneralPageFocusListener(this)),
pDatMan(pMan) pDatMan(pMan)
{ {
get(pIdentifierFT, "shortname"); get(pIdentifierFT, "shortname");
...@@ -387,6 +387,7 @@ void BibGeneralPage::dispose() ...@@ -387,6 +387,7 @@ void BibGeneralPage::dispose()
pCustom4FT.clear(); pCustom4FT.clear();
pCustom5FT.clear(); pCustom5FT.clear();
for (auto & a: aFixedTexts) a.clear(); for (auto & a: aFixedTexts) a.clear();
mxBibGeneralPageFocusListener.clear();
BibTabPage::dispose(); BibTabPage::dispose();
} }
...@@ -397,7 +398,7 @@ void BibGeneralPage::RemoveListeners() ...@@ -397,7 +398,7 @@ void BibGeneralPage::RemoveListeners()
if(aControls[i].is()) if(aControls[i].is())
{ {
uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY ); uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY );
xCtrWin->removeFocusListener( &maBibGeneralPageFocusListener ); xCtrWin->removeFocusListener( mxBibGeneralPageFocusListener.get() );
aControls[i] = 0; aControls[i] = 0;
} }
} }
...@@ -488,7 +489,7 @@ uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl( ...@@ -488,7 +489,7 @@ uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl(
// Peer as Child to the FrameWindow // Peer as Child to the FrameWindow
xCtrlContnr->addControl(rName, xControl); xCtrlContnr->addControl(rName, xControl);
uno::Reference< awt::XWindow > xCtrWin(xControl, UNO_QUERY ); uno::Reference< awt::XWindow > xCtrWin(xControl, UNO_QUERY );
xCtrWin->addFocusListener( &maBibGeneralPageFocusListener ); xCtrWin->addFocusListener( mxBibGeneralPageFocusListener.get() );
rIndex = -1; // -> implies, that not found rIndex = -1; // -> implies, that not found
for(sal_uInt16 i = 0; i < FIELD_COUNT; i++) for(sal_uInt16 i = 0; i < FIELD_COUNT; i++)
if(!aControls[i].is()) if(!aControls[i].is())
......
...@@ -127,7 +127,7 @@ class BibGeneralPage: public BibTabPage ...@@ -127,7 +127,7 @@ class BibGeneralPage: public BibTabPage
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener > ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >
xPosListener; xPosListener;
BibGeneralPageFocusListener maBibGeneralPageFocusListener; rtl::Reference<BibGeneralPageFocusListener> mxBibGeneralPageFocusListener;
BibDataManager* pDatMan; BibDataManager* pDatMan;
...@@ -164,7 +164,7 @@ public: ...@@ -164,7 +164,7 @@ public:
virtual bool HandleShortCutKey( const KeyEvent& rKeyEvent ) SAL_OVERRIDE; // returns true, if key was handled 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 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 ); void focusLost(const css::awt::FocusEvent& rEvent) throw( css::uno::RuntimeException, std::exception );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment