diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-13 22:04:49 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-14 23:53:51 -0500 |
commit | f076c62d5cce5425d903b861827c83c16a040b86 (patch) | |
tree | 7f506555ed613e10dc53fcb3205ce8479571b4bf /svl/source | |
parent | 18d07b2affbbbfb2ff9152d3ad8d1744fe75ab47 (diff) |
No need to individually remove listeners when being destroyed.
Otherwise a crash would ensue.
Change-Id: I9a52524cc205765d059745e9f7e914b636667cb6
Diffstat (limited to 'svl/source')
-rw-r--r-- | svl/source/notify/broadcast.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx index 79c17578e25d..7e59e36e2ec7 100644 --- a/svl/source/notify/broadcast.cxx +++ b/svl/source/notify/broadcast.cxx @@ -69,21 +69,25 @@ void SvtBroadcaster::Add( SvtListener* p ) void SvtBroadcaster::Remove( SvtListener* p ) { + if (mbDying) + return; + maListeners.erase(p); if (maListeners.empty()) ListenersGone(); } -SvtBroadcaster::SvtBroadcaster() {} +SvtBroadcaster::SvtBroadcaster() : mbDying(false) {} SvtBroadcaster::SvtBroadcaster( const SvtBroadcaster &rBC ) : - maListeners(rBC.maListeners) + maListeners(rBC.maListeners), mbDying(false) { std::for_each(maListeners.begin(), maListeners.end(), StartListeningHandler(*this)); } SvtBroadcaster::~SvtBroadcaster() { + mbDying = true; Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); // unregister all listeners. |