summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-07-19 14:53:52 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2022-08-18 19:17:16 +0200
commit8067c5a66538b2fc31bbed9d5ae7dbfcaa6821f6 (patch)
tree360f560e6ffc6d7651e76b649738204090329998 /sfx2
parentafb52ce707679c2fe6f2dbdef2670b1d34f45604 (diff)
tdf#148913 sw: fix crash with pending infobars on Windows
Usage of VclPtr<SfxInfoBarWindow> wasn't thread-safe on Windows, resulting random crashing during loading big documents. Regression from commit d89786054715b44aa983d0752484216825c74ae2 "tdf#125909 tdf#141298 sw: show (Hidden) Track Changes infobar". Change-Id: Ic6a6ad43a8cf7ea650ef6d1c0aa5c76c48763ea8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137230 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 85a044abdf08bafa93e1caddf38f86e35d7e17f2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137184 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/viewfrm.cxx44
1 files changed, 29 insertions, 15 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 7f3bf1a6bcc2..dfc0792ae9b2 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1537,27 +1537,41 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
}
}
- VclPtr<SfxInfoBarWindow> pInfoBar =
- AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage,
+ // Track Changes infobar: add a button to show/hide Track Changes functions
+ // Hyphenation infobar: add a button to get more information
+ // tdf#148913 limit VclPtr usage for these
+ bool bTrackChanges = aInfobarData.msId == "hiddentrackchanges";
+ if ( bTrackChanges || aInfobarData.msId == "hyphenationmissing" )
+ {
+ VclPtr<SfxInfoBarWindow> pInfoBar =
+ AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage,
aInfobarData.msSecondaryMessage, aInfobarData.maInfobarType,
aInfobarData.mbShowCloseButton);
- // Track Changes infobar: add a button to show/hide Track Changes functions
- if ( pInfoBar && aInfobarData.msId == "hiddentrackchanges" )
- {
- weld::Button& rTrackChangesButton = pInfoBar->addButton();
- rTrackChangesButton.set_label(SfxResId(STR_TRACK_CHANGES_BUTTON));
- rTrackChangesButton.connect_clicked(LINK(this,
+ // tdf#148913 don't extend this condition to keep it thread-safe
+ if (pInfoBar)
+ {
+ weld::Button& rButton = pInfoBar->addButton();
+ rButton.set_label(SfxResId(bTrackChanges
+ ? STR_TRACK_CHANGES_BUTTON
+ : STR_HYPHENATION_BUTTON));
+ if (bTrackChanges)
+ {
+ rButton.connect_clicked(LINK(this,
SfxViewFrame, HiddenTrackChangesHandler));
+ }
+ else
+ {
+ rButton.connect_clicked(LINK(this,
+ SfxViewFrame, HyphenationMissingHandler));
+ }
+ }
}
-
- // Hyphenation infobar: add a button to get more information
- if ( pInfoBar && aInfobarData.msId == "hyphenationmissing" )
+ else
{
- weld::Button& rHyphenationButton = pInfoBar->addButton();
- rHyphenationButton.set_label(SfxResId(STR_HYPHENATION_BUTTON));
- rHyphenationButton.connect_clicked(LINK(this,
- SfxViewFrame, HyphenationMissingHandler));
+ AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage,
+ aInfobarData.msSecondaryMessage, aInfobarData.maInfobarType,
+ aInfobarData.mbShowCloseButton);
}
aPendingInfobars.pop_back();