Bug 131431 - Find & Replace dialog: LO hangs on formatting replacement when thousands of replacements to do
Summary: Find & Replace dialog: LO hangs on formatting replacement when thousands of r...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium major
Assignee: Not Assigned
URL:
Whiteboard: target:26.8.0
Keywords:
: 155450 165447 166278 (view as bug list)
Depends on:
Blocks: Find&Replace-Dialog
  Show dependency treegraph
 
Reported: 2020-03-20 03:09 UTC by kaanchan
Modified: 2026-02-11 21:36 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
screenshot (10.34 KB, image/png)
2020-03-20 03:11 UTC, kaanchan
Details
sample file (55.30 KB, application/vnd.oasis.opendocument.text)
2022-03-27 13:51 UTC, Dieter
Details
.odt file created to test bug fix (14.59 KB, application/vnd.oasis.opendocument.text)
2026-02-10 23:17 UTC, christopherlum334
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kaanchan 2020-03-20 03:09:51 UTC
Description:
I tried to search for any character that was a particular font in bold. When I pressed Replace All, a prompt appeared saying "to continue Undo must be disabled". I accepted, then progress wheel appeared for an indefinite time (I waited 15 minutes before aborting).

Steps to Reproduce:
1. Open document
2. Open Find & Replace dialogue
3. Place cursor in Find field
4. Select a font in Format dialogue which appears many times in document
5. Place cursor in Replace field
6. In Format dialogue select same font previously selected from Font tab in step 4 and select a background color (yellow) from Highlight tab 
7. Click Replace All

Actual Results:
1. After 60,000 character replacements, prompt appears "To proceed with this action, you must first turn off the "undo" function. Do you want to turn off the "undo" function?"
2. Clicking No or Cancel resumes normal control of the application. Clicking Yes results in indefinite hanging. 

Expected Results:
1. Clicking Yes should allow the operation to complete.


Reproducible: Always


User Profile Reset: No



Additional Info:
In my document, after 60000 characters replacements, only 286 were remaining. I was able to do a second search/replace with no issue on jus the remaining selection. Clicking "Yes" to turning off the Undo feature seems to go down a code pathway that causes the hanging. 

Version: 6.4.1.2 (x64)
Build ID: 4d224e95b98b138af42a64d84056446d09082932
CPU threads: 12; OS: Windows 10.0 Build 18362; UI render: GL; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded
Comment 1 kaanchan 2020-03-20 03:11:41 UTC
Created attachment 158827 [details]
screenshot

Sample input in search/replace dialogue
Comment 2 kaanchan 2020-03-20 03:50:32 UTC
Interesting to note that if I do search and replace in chunks, i.e. without accepting to disbable the Undo feature, then I can still do a single click (ctrl+z) undo of a mass replacement.

Is it then possible for the algorithm to do large search/replace operations in 60,000 character (or whatever defines the limit) chunks? This would allow the user to undo mass changes, which is desired, rather than leave them without Undo feature for such large changes.
Comment 3 Dieter 2020-03-25 18:30:13 UTC
I confirm it with

Version: 7.0.0.0.alpha0+ (x64)
Build ID: 5dcbd1bb557450a2d658a710c163b310c0cee157
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-GB
Calc: CL
Comment 4 QA Administrators 2022-03-26 03:35:50 UTC Comment hidden (obsolete)
Comment 5 Dieter 2022-03-27 13:51:34 UTC
Created attachment 179141 [details]
sample file

Still present in

Version: 7.3.2.2 (x64) / LibreOffice Community
Build ID: 49f2b1bff42cfccbd8f788c8dc32c1c309559be0
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Tested with attached file
Comment 6 Stéphane Guillou (stragu) 2023-05-24 08:32:55 UTC
*** Bug 155450 has been marked as a duplicate of this bug. ***
Comment 7 Stéphane Guillou (stragu) 2023-05-24 08:51:00 UTC
Reproducible in:

Version: 7.5.3.2 (X86_64) / LibreOffice Community
Build ID: 9f56dff12ba03b9acd7730a5a481eea045e468f3
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

As well as a recent master build:

Version: 7.6.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: f4c24da1e7f11664e0d2f688d2531f068e4a3bc0
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Hangs with 100% use of a core.

Same freeze in OOo 3.3, so issue is inherited.

Changing severity to "major" as it's a complete freeze that requires force-quitting and might result in data loss.
Comment 8 QA Administrators 2025-05-24 03:12:05 UTC Comment hidden (obsolete)
Comment 9 Dieter 2025-06-15 16:35:45 UTC
Still present in

Version: 25.2.4.3 (X86_64) / LibreOffice Community
Build ID: 33e196637044ead23f5c3226cde09b47731f7e27
CPU threads: 12; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Vulkan; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL threaded
Comment 10 Mateusz Wlazłowski 2025-08-01 15:28:11 UTC
*** Bug 165447 has been marked as a duplicate of this bug. ***
Comment 11 Mateusz Wlazłowski 2025-08-01 15:28:30 UTC
*** Bug 166278 has been marked as a duplicate of this bug. ***
Comment 12 Commit Notification 2026-02-09 09:15:25 UTC
Mateusz Wlazłowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/17c9b49f3d215b58604a3d301b18ada322e3986f

tdf#131431 Move next node if pCurrentCursor hasn't moved in replaceAll

It will be available in 26.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 christopherlum334 2026-02-10 23:17:54 UTC
Created attachment 205457 [details]
.odt file created to test bug fix

.odt file created to test bug fix
Comment 14 christopherlum334 2026-02-10 23:31:06 UTC
Tested bug fix and confirm that when using Find and Replace to find underlined characters and apply yellow highlighting I no longer get a message "To proceed with this action, you must first turn off the "undo" function. Do you want to turn off the "undo" function?".  Instead, the underlined characters are highlighted in yellow, as desired.

Steps to reproduce
1. Open test file "2026-02-10 Test file animals.odt"
2. Edit > Find and Replace
3. Click on "Find:" field > Attributes > Other options > Underline > OK
4. Click on "Replace:" field > Format > Highlighting > Color > Yellow > OK
5. Replace All 

When using Find and Replace to find bold or italicized characters and apply yellow highlighting I no longer get a message "To proceed with this action, you must first turn off the "undo" function. Do you want to turn off the "undo" function?".
Instead, the yellow highlighting is applied.
But the characters are no longer bold or italicized; instead they are regular. 

Steps to reproduce
1. Open test file "2026-02-10 Test file animals.odt"
2. Edit > Find and Replace
3. Click on "Find:" field > No Format (if necessary)
3. Click on "Find:" field > Format > Font > look under "Western" > Style > either Bold or Italic > OK
4. Click on "Replace:" field > Format > Highlighting > Color > Yellow > OK
5. Replace All 

The expected result is that bold and italicized fonts would retain their respective font styles after highlighting.
Comment 15 Mateusz Wlazłowski 2026-02-11 17:15:36 UTC
(In reply to christopherlum334 from comment #14)
> When using Find and Replace to find bold or italicized characters and apply
> yellow highlighting I no longer get a message "To proceed with this action,
> you must first turn off the "undo" function. Do you want to turn off the
> "undo" function?".
> Instead, the yellow highlighting is applied.
> But the characters are no longer bold or italicized; instead they are
> regular. 
> 
> The expected result is that bold and italicized fonts would retain their
> respective font styles after highlighting.


Thanks for testing

I checked 26.2.0.3 and it had the same issue you're describing -- not related to the patch

Version: 26.2.0.3 (X86_64)
Build ID: afbbd0df0edb6d40b450b0337ac646b0913a760c
CPU threads: 8; OS: Linux 6.17; UI render: default; VCL: gtk3
Locale: en-GB (en_US.UTF-8); UI: en-US
Flatpak
Calc: threaded


Could you make a new bug report and CC me? (unless this was already reported) Thanks
Comment 16 christopherlum334 2026-02-11 21:36:05 UTC
I have submitted Bug 170738 and cc: mateusz.csi@gmail.com