Bug 153510 - Conditional formatting with STYLE and incorrect (case) style name -> continuous CPU consumption, menus not drawn in some UI renders
Summary: Conditional formatting with STYLE and incorrect (case) style name -> continuo...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.0.3 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:7.6.0 target:7.5.2 target:7.4.6
Keywords:
Depends on:
Blocks: Conditional-Formatting Calc-Styles
  Show dependency treegraph
 
Reported: 2023-02-10 06:24 UTC by Mike Kaganski
Modified: 2023-03-29 06:20 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
STYLE in conditional formatting (1.46 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-02-10 06:24 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2023-02-10 06:24:10 UTC
Created attachment 185277 [details]
STYLE in conditional formatting

The attached spreadsheet (FODT, simplified to bare minimum) has two cells (A1:A2) with conditional formatting having STYLE function that tries to set a style name differing (in character case) from the style name present in the document: it uses "STYLE(A1)" formula. The content of the cells is "A"; the style in the document is named "a" (and it gets applied to the cells, as one can see in the stylist).

Since v.5.1, opening it and having the two cells in view, results in continuous 100% CPU consumption (single core). In that version, using OpenGL (Windows), menus still were working OK.

Since v.5.2, using OpenGL, menus are shown blank (likely, the priority of drawing their content is lower than the priority of the continuous processing taking the 100% of a core). Disabling OpenGL, the menus are drawn OK, but the CPU consumption is unchanged (so the menu drawing priority is obviously different).

In current master, Skia works the same way as OpenGL in old versions (now showing menus when the cells are in view; likely because it was modelled after OpenGL render, and has similar priorities). As before, not using Skia still shows continuous CPU consumption.

Changing cells' content from "A" to "a" (to match case of actual style) stops the CPU consumption.

The usefulness of using STYLE in conditional formatting is not a matter here, only the wrong effects.
Comment 1 Commit Notification 2023-02-10 06:25:22 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a80630b6ee6e7636d2c93c42724ce815c991311c

Related: tdf#153510 Avoid modification of iterated container

It will be available in 7.6.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 2 Mike Kaganski 2023-02-10 07:44:00 UTC
The CPU consumption part started after commit 87199d3829257420429057336283c55be6ae7481 ("vcl: re-introduce idle handling.", 2015-11-24).

The menus disappeared after commit 8d6c1b6981f01bbc0057234f53fd139e87a5f010 ("tdf#96385 - opengl: dynamically adjust priority of swap buffers.", 2016-01-12).
Comment 3 Commit Notification 2023-02-10 14:05:14 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/a01f4a1c317520a7a3090cfb2f1c9f21bbc50922

Related: tdf#153510 Avoid modification of iterated container

It will be available in 7.5.2.

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 4 Commit Notification 2023-02-10 16:33:32 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/208a4ecafafa97ea7fcc5a135fa8160e91ea0a74

tdf#153510: STYLE: try harder to detect when there's nothing to do

It will be available in 7.6.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 5 Commit Notification 2023-02-13 00:05:08 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/fed875f35be3204a7d77bf315a07caaa3bf635e9

tdf#153510: STYLE: try harder to detect when there's nothing to do

It will be available in 7.5.2.

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 6 Commit Notification 2023-02-13 11:53:04 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/f6aa9d4f9f5e7b46a89bf409a40b552570cf4d5f

Related: tdf#153510 Avoid modification of iterated container

It will be available in 7.4.6.

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 7 Mike Kaganski 2023-02-13 12:07:35 UTC
Let me call this fixed. The problem can still be reproduced by using three-argument STYLE in conditional formatting (and using different styles for immediate and delayed application), but that would be another issue (I suppose it would be much less likely to occur, and I don't have a good idea how to avoid the problem then, other than preventing misuse of the function in conditional formatting at all).
Comment 8 Commit Notification 2023-02-14 08:40:01 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/b2494cc8b9a22429e331e29093f7bb066ae5f8f2

tdf#153510: STYLE: try harder to detect when there's nothing to do

It will be available in 7.4.6.

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.