summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-07-19 14:53:52 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2022-07-19 20:01:22 +0200
commit06229e4df02ddccb0408538271e0fbf683847355 (patch)
tree1f5cfa20e6e0fa6eddf80f7b19f8972868fac59b
parente0688221202176cb4d5dfb91ae777afb3075d956 (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 a3745e55c9976cb5f7cfce341bc5dc2e7fc4fa6e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137183 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-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 f0f539ca675d..3e09372dd781 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();