diff options
author | László Németh <nemeth@numbertext.org> | 2022-07-19 14:53:52 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2022-07-19 18:02:18 +0200 |
commit | 85a044abdf08bafa93e1caddf38f86e35d7e17f2 (patch) | |
tree | cc223375abb4196b583fdb8ce02c801a8169c3e0 /sfx2/source | |
parent | a1ca68e91868df51a269682f7c3dac62a88a85ef (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>
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 1e4ad7085fad..da5477928f51 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1511,27 +1511,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(); |