diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-17 13:38:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-17 14:03:30 +0100 |
commit | 3c822ccbf013b2c9129cbb4717890114bfdd06ee (patch) | |
tree | 064ccde36d74503d7588a7b58d0d5fd2b6fd9cf8 /desktop | |
parent | 78c06b370de7872479d0b6c56c4dddd10cb14144 (diff) |
Related: rhbz#702833 addEventListener without removeEventListener
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 7b00c4ede248..96e4e596ca71 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -970,18 +970,20 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & if ( ! pEntry->m_sTitle.Len() ) return 0; - xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) ); + bool bNewEntryInserted = false; ::osl::ClearableMutexGuard guard(m_entriesMutex); if ( m_vEntries.empty() ) { m_vEntries.push_back( pEntry ); + bNewEntryInserted = true; } else { if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) ) { m_vEntries.insert( m_vEntries.begin()+nPos, pEntry ); + bNewEntryInserted = true; } else if ( !m_bInCheckMode ) { @@ -989,6 +991,14 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & } } + //Related: rhbz#702833 Only add a Listener if we're adding a new entry, to + //keep in sync with removeEventListener logic + if (bNewEntryInserted) + { + pEntry->m_xPackage->addEventListener(uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) ); + } + + pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); pEntry->m_bUser = xPackage->getRepositoryName().equals( USER_PACKAGE_MANAGER ); pEntry->m_bShared = xPackage->getRepositoryName().equals( SHARED_PACKAGE_MANAGER ); |