diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-11-02 16:08:25 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-02 16:30:14 +0000 |
commit | a4ebfb2b74c6db274ae8b7ed0579a6edf47597fe (patch) | |
tree | 8ad970ac127899d459c3c29fb00cec623bd4502c | |
parent | 9bf204f9aa2caefac13a1a680a669ba74b3731cf (diff) |
afl-eventtesting: crash close impress with spelling dialog active
Change-Id: I1085b655a9a589f2e92edfdacfea6621d2f67d9c
-rw-r--r-- | sd/inc/Outliner.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/dlg/SpellDialogChildWindow.cxx | 44 | ||||
-rw-r--r-- | sd/source/ui/inc/SpellDialogChildWindow.hxx | 6 | ||||
-rw-r--r-- | vcl/qa/afl-eventtesting/eventtesting.impress.crash-4 | bin | 0 -> 208 bytes |
4 files changed, 38 insertions, 13 deletions
diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx index 931854d15009..ec54eabee35e 100644 --- a/sd/inc/Outliner.hxx +++ b/sd/inc/Outliner.hxx @@ -180,6 +180,7 @@ public: int GetIgnoreCurrentPageChangesLevel() const { return mnIgnoreCurrentPageChangesLevel; }; void IncreIgnoreCurrentPageChangesLevel() { mnIgnoreCurrentPageChangesLevel++; }; void DecreIgnoreCurrentPageChangesLevel() { mnIgnoreCurrentPageChangesLevel--; }; + SdDrawDocument* GetDoc() const { return mpDrawDocument; } private: class Implementation; diff --git a/sd/source/ui/dlg/SpellDialogChildWindow.cxx b/sd/source/ui/dlg/SpellDialogChildWindow.cxx index dbf9c9d8584d..b59696c8290a 100644 --- a/sd/source/ui/dlg/SpellDialogChildWindow.cxx +++ b/sd/source/ui/dlg/SpellDialogChildWindow.cxx @@ -48,11 +48,7 @@ SpellDialogChildWindow::SpellDialogChildWindow ( SpellDialogChildWindow::~SpellDialogChildWindow() { - if (mpSdOutliner != NULL) - mpSdOutliner->EndSpelling(); - - if (mbOwnOutliner) - delete mpSdOutliner; + EndSpellingAndClearOutliner(); } SfxChildWinInfo SpellDialogChildWindow::GetInfo() const @@ -103,6 +99,29 @@ void SpellDialogChildWindow::LoseFocus() { } +void SpellDialogChildWindow::EndSpellingAndClearOutliner() +{ + if (!mpSdOutliner) + return; + EndListening(*mpSdOutliner->GetDoc()); + mpSdOutliner->EndSpelling(); + if (mbOwnOutliner) + delete mpSdOutliner; + mpSdOutliner = NULL; + mbOwnOutliner = false; +} + +void SpellDialogChildWindow::Notify(SfxBroadcaster&, const SfxHint& rHint) +{ + if (const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint)) + { + if (HINT_MODELCLEARED == pSdrHint->GetKind()) + { + EndSpellingAndClearOutliner(); + } + } +} + void SpellDialogChildWindow::ProvideOutliner() { ViewShellBase* pViewShellBase = dynamic_cast<ViewShellBase*>( SfxViewShell::Current() ); @@ -116,10 +135,7 @@ void SpellDialogChildWindow::ProvideOutliner() if(( dynamic_cast< const DrawViewShell *>( pViewShell ) != nullptr && ! mbOwnOutliner) || (dynamic_cast< const OutlineViewShell *>( pViewShell ) != nullptr && mbOwnOutliner)) { - mpSdOutliner->EndSpelling(); - if (mbOwnOutliner) - delete mpSdOutliner; - mpSdOutliner = NULL; + EndSpellingAndClearOutliner(); } // Now create/get an outliner if none is present. @@ -130,16 +146,18 @@ void SpellDialogChildWindow::ProvideOutliner() // We need an outliner for the spell check so we have // to create one. mbOwnOutliner = true; - mpSdOutliner = new Outliner ( - pViewShell->GetDoc(), - OUTLINERMODE_TEXTOBJECT); + SdDrawDocument *pDoc = pViewShell->GetDoc(); + mpSdOutliner = new Outliner(pDoc, OUTLINERMODE_TEXTOBJECT); + StartListening(*pDoc); } else if( dynamic_cast< const OutlineViewShell *>( pViewShell ) != nullptr) { // An outline view is already visible. The SdOutliner // will use it instead of creating its own. mbOwnOutliner = false; - mpSdOutliner = pViewShell->GetDoc()->GetOutliner(); + SdDrawDocument *pDoc = pViewShell->GetDoc(); + mpSdOutliner = pDoc->GetOutliner(); + StartListening(*pDoc); } // Initialize spelling. diff --git a/sd/source/ui/inc/SpellDialogChildWindow.hxx b/sd/source/ui/inc/SpellDialogChildWindow.hxx index dbfe0be5fdc8..3d6f654fee50 100644 --- a/sd/source/ui/inc/SpellDialogChildWindow.hxx +++ b/sd/source/ui/inc/SpellDialogChildWindow.hxx @@ -32,6 +32,7 @@ class Outliner; */ class SpellDialogChildWindow : public svx::SpellDialogChildWindow + , public SfxListener { public: SpellDialogChildWindow ( @@ -46,6 +47,9 @@ public: */ void InvalidateSpellDialog(); + // SfxListener + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; + SFX_DECL_CHILDWINDOW_WITHID(SpellDialogChildWindow); protected: @@ -79,6 +83,8 @@ private: construction/obtaining of a new one. */ void ProvideOutliner(); + + void EndSpellingAndClearOutliner(); }; } // end of namespace ::sd diff --git a/vcl/qa/afl-eventtesting/eventtesting.impress.crash-4 b/vcl/qa/afl-eventtesting/eventtesting.impress.crash-4 Binary files differnew file mode 100644 index 000000000000..3b0f9bc82bf9 --- /dev/null +++ b/vcl/qa/afl-eventtesting/eventtesting.impress.crash-4 |