summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-15 14:10:30 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-16 09:17:22 +0100
commit5a8ea2218a352561a3f494af545d9b978766a513 (patch)
tree39d49e96342fd94374050cfa56e17e0ec623cae5 /svl
parent56b96f3cc1f03313afade4f642861efb76d0bb54 (diff)
ofz#6311 still problems with SdrEdgeObj listening to same obj at start as end
Change-Id: Ibd80b484788779b73943b28a5f36e51ebcacec30 Reviewed-on: https://gerrit.libreoffice.org/49824 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/qa/unit/notify/test_SfxBroadcaster.cxx8
-rw-r--r--svl/source/notify/lstner.cxx8
2 files changed, 8 insertions, 8 deletions
diff --git a/svl/qa/unit/notify/test_SfxBroadcaster.cxx b/svl/qa/unit/notify/test_SfxBroadcaster.cxx
index 58c8df532590..5d043028c402 100644
--- a/svl/qa/unit/notify/test_SfxBroadcaster.cxx
+++ b/svl/qa/unit/notify/test_SfxBroadcaster.cxx
@@ -62,7 +62,7 @@ SfxBroadcasterTest::AddingListenersIncreasesCount()
CPPUNIT_ASSERT_EQUAL((size_t)0, sb.GetListenerCount());
- sl.StartListening(sb, true);
+ sl.StartListening(sb, DuplicateHandling::Prevent);
CPPUNIT_ASSERT_EQUAL((size_t)1, sb.GetListenerCount());
}
@@ -73,7 +73,7 @@ SfxBroadcasterTest::RemovingListenersDecreasesCount()
MockedSfxListener sl;
CPPUNIT_ASSERT_EQUAL((size_t)0, sb.GetListenerCount());
- sl.StartListening(sb, true);
+ sl.StartListening(sb, DuplicateHandling::Prevent);
CPPUNIT_ASSERT_EQUAL((size_t)1, sb.GetListenerCount());
sl.EndListening(sb, true);
CPPUNIT_ASSERT_EQUAL((size_t)0, sb.GetListenerCount());
@@ -87,8 +87,8 @@ SfxBroadcasterTest::HintsAreNotForwardedToRemovedListeners()
MockedSfxListener sl2;
SfxHint hint;
- sl1.StartListening(sb, true);
- sl2.StartListening(sb, true);
+ sl1.StartListening(sb, DuplicateHandling::Prevent);
+ sl2.StartListening(sb, DuplicateHandling::Prevent);
CPPUNIT_ASSERT_EQUAL_MESSAGE("All listeners were added.", (size_t)2, sb.GetListenerCount());
sl1.EndListening(sb, true);
sb.Forward(sb, hint);
diff --git a/svl/source/notify/lstner.cxx b/svl/source/notify/lstner.cxx
index 9c79da9e5185..5be1e2bdffdf 100644
--- a/svl/source/notify/lstner.cxx
+++ b/svl/source/notify/lstner.cxx
@@ -88,20 +88,20 @@ void SfxListener::RemoveBroadcaster_Impl( SfxBroadcaster& rBroadcaster )
Some code uses duplicates as a kind of ref-counting thing i.e. they add and remove listeners
on different code paths, and they only really stop listening when the last EndListening() is called.
*/
-void SfxListener::StartListening( SfxBroadcaster& rBroadcaster, bool bPreventDuplicates )
+void SfxListener::StartListening(SfxBroadcaster& rBroadcaster, DuplicateHandling eDuplicateHanding)
{
bool bListeningAlready = IsListening( rBroadcaster );
#ifdef DBG_UTIL
- if (bListeningAlready && !bPreventDuplicates)
+ if (bListeningAlready && eDuplicateHanding == DuplicateHandling::Unexpected)
{
auto f = mpImpl->maCallStacks.find( &rBroadcaster );
SAL_WARN("svl", "previous StartListening call came from: " << sal::backtrace_to_string(f->second.get()));
}
#endif
- assert(!(bListeningAlready && !bPreventDuplicates) && "duplicate listener, try building with DBG_UTIL to find the other insert site.");
+ assert(!(bListeningAlready && eDuplicateHanding == DuplicateHandling::Unexpected) && "duplicate listener, try building with DBG_UTIL to find the other insert site.");
- if ( !bListeningAlready || !bPreventDuplicates )
+ if (!bListeningAlready || eDuplicateHanding != DuplicateHandling::Prevent)
{
rBroadcaster.AddListener(*this);
mpImpl->maBCs.push_back( &rBroadcaster );