Bug 127189 - Editing a particular math formula using underbrace / overbrace destroys the UI under GTK3
Summary: Editing a particular math formula using underbrace / overbrace destroys the U...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
6.0.7.3 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:6.4.0 target:6.3.2 target:6.2.8
Keywords: bibisected, bisected
Depends on:
Blocks: Formula-Editor GTK3
  Show dependency treegraph
 
Reported: 2019-08-27 19:54 UTC by Jean-Baptiste Faure
Modified: 2023-04-04 11:40 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
test file (math formula) (4.19 KB, application/vnd.oasis.opendocument.formula)
2019-08-27 19:57 UTC, Jean-Baptiste Faure
Details
test file with embedded formula from real life (15.39 KB, application/vnd.oasis.opendocument.text)
2019-08-27 20:02 UTC, Jean-Baptiste Faure
Details
pdf export (21.01 KB, application/pdf)
2019-08-27 20:02 UTC, Jean-Baptiste Faure
Details
screencopy with gtk3 plugin (view) (80.27 KB, image/png)
2019-08-27 20:04 UTC, Jean-Baptiste Faure
Details
screencopy with gtk3 plugin (editing) (15.00 KB, image/png)
2019-08-27 20:04 UTC, Jean-Baptiste Faure
Details
screencopy with gen plugin (89.27 KB, image/png)
2019-08-27 20:05 UTC, Jean-Baptiste Faure
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Baptiste Faure 2019-08-27 19:54:41 UTC
Description:
In the formmula {expression_1} underbrace {expression_2} if expression_1 is large enough, the UI disappears and it is not possible to recover it without closing LO.

Steps to Reproduce:
0. download first attachment (test_formula.odf)
1. in a terminal, launch LO with the following command : SAL_USE_VCLPLUGIN=gtk3 libreoffice6.3 test_formula.odf
2. in the command panel, add one letter at the end of first expression (ABCD...)
3.

Actual Results:
View panel and command panel disappear and it is not possible to recover the hand on LO. The only thing to do is to close LO using Ctrl+Q or the main menu.

In the terminal, I get several blocs of the following error messages:
(soffice:18182): Gtk-WARNING **: 21:32:09.346: drawing failure for widget 'OOoFixed': error occurred in libfreetype
(soffice:18182): Gtk-WARNING **: 21:32:09.346: drawing failure for widget 'GtkEventBox': error occurred in libfreetype
(soffice:18182): Gtk-WARNING **: 21:32:09.346: drawing failure for widget 'GtkGrid': error occurred in libfreetype
(soffice:18182): Gtk-WARNING **: 21:32:09.347: drawing failure for widget 'GtkWindow': error occurred in libfreetype

No other messages than these ones. 

Same behavior if the math formula is embedded in a text document. If I open a text document (e.g. the second attachment) containing such a formula with LO under GTK3, the formula is not visible. If I try to edit the formula the UI disappears. All formulas that follow the wrong formula become invisible.

If I use the generic backend  (SAL_USE_VCLPLUGIN=gen libreoffice6.3 test_formula.odf) the underbrace becomes invisible when I edit the formula but the UI is not destroyed. 

Expected Results:
Be able to view and edit a math formula like this one. 


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Even if the formula is not visible, PDF export works as expected.

I reproduce the problem in LO 6.0 (from Ubuntu), 6.1, 6.2, 6.3 and master (all built at home under Ubuntu 18.04 x86-64).
My version of libfreetype is 2.8.1-2ubuntu2
Comment 1 Jean-Baptiste Faure 2019-08-27 19:57:23 UTC
Created attachment 153688 [details]
test file (math formula)
Comment 2 Jean-Baptiste Faure 2019-08-27 20:02:14 UTC
Created attachment 153689 [details]
test file with embedded formula from real life
Comment 3 Jean-Baptiste Faure 2019-08-27 20:02:39 UTC
Created attachment 153690 [details]
pdf export
Comment 4 Jean-Baptiste Faure 2019-08-27 20:04:02 UTC
Created attachment 153691 [details]
screencopy with gtk3 plugin (view)
Comment 5 Jean-Baptiste Faure 2019-08-27 20:04:28 UTC
Created attachment 153692 [details]
screencopy with gtk3 plugin (editing)
Comment 6 Jean-Baptiste Faure 2019-08-27 20:05:05 UTC
Created attachment 153693 [details]
screencopy with gen plugin
Comment 7 Jean-Baptiste Faure 2019-08-27 20:09:49 UTC
set as regression because it worked with earlier version. That said I do not know if the problem is in LibreOffice or in libfreetype.

Set importance as high/major because user may believe that her document is corrupted and her data are lost.

Best regards. JBF
Comment 8 Laurent Balland 2019-08-27 21:05:33 UTC
I can reproduce with Version: 6.3.0.4
Build ID: 057fc023c990d676a43019934386b85b21a9ee99
Threads CPU : 8; OS : Linux 4.15; UI Render : par défaut; VCL: gtk3; 
Locale : fr-FR (fr_FR.UTF-8); Langue IHM : fr-FR
Calc: threaded
Comment 9 Laurent Balland 2019-08-27 21:15:33 UTC
I do NOT reproduce with:
- Version: 6.0.7.2
Build ID: 78c12ce5f2b8960f18b204a7ea82f971769f1679
Threads CPU : 8; OS : Linux 4.15; UI Render : par défaut; VCL: gtk2; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group
- Version: 6.1.6.3
Build ID: 5896ab1714085361c45cf540f76f60673dd96a72
Threads CPU : 8; OS : Linux 4.15; UI Render : par défaut; VCL: gtk2; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group threaded

I DO reproduce with:
- Version: 6.2.6.2
Build ID: 684e730861356e74889dfe6dbddd3562aae2e6ad
Threads CPU : 8; OS : Linux 4.15; UI Render : par défaut; VCL: gtk3; 
Locale : fr-FR (fr_FR.UTF-8); Langue IHM : fr-FR
Calc: threaded
Comment 10 Jean-Baptiste Faure 2019-08-27 21:32:14 UTC
(In reply to Laurent BP from comment #9)
> I do NOT reproduce with:
> - Version: 6.0.7.2
> Build ID: 78c12ce5f2b8960f18b204a7ea82f971769f1679
> Threads CPU : 8; OS : Linux 4.15; UI Render : par défaut; VCL: gtk2; 
> Locale : fr-FR (fr_FR.UTF-8); Calc: group
> - Version: 6.1.6.3
> Build ID: 5896ab1714085361c45cf540f76f60673dd96a72
> Threads CPU : 8; OS : Linux 4.15; UI Render : par défaut; VCL: gtk2; 
> Locale : fr-FR (fr_FR.UTF-8); Calc: group threaded
> 
> I DO reproduce with:
> - Version: 6.2.6.2
> Build ID: 684e730861356e74889dfe6dbddd3562aae2e6ad
> Threads CPU : 8; OS : Linux 4.15; UI Render : par défaut; VCL: gtk3; 
> Locale : fr-FR (fr_FR.UTF-8); Langue IHM : fr-FR
> Calc: threaded

Do you see the big underbrace with gtk2 ?

Best regards. JBF
Comment 11 Laurent Balland 2019-08-27 22:22:12 UTC
There is no large underbrace with "ce qui entre", with any version, with any VCL I tested. Even with old Version: 5.2.7.2
Build ID: 2b7f1e640c46ceb28adf43ee075a6e8b8439ed10
Threads CPU : 8; Version de l'OS :Linux 4.15; UI Render : par défaut; VCL : x11; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group
I saw it in small preview, preview printing and PDF export.
Comment 12 Laurent Balland 2019-08-27 22:28:19 UTC
Equation is visible (except the big underbrace "ce qui entre") also with LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 13 Laurent Balland 2019-08-27 22:31:41 UTC
(In reply to Laurent BP from comment #12)
> Equation is visible (except the big underbrace "ce qui entre") also with
> LibreOffice 3.3.0 
> OOO330m19 (Build:6)
> tag libreoffice-3.3.0.4

Same behavior as LibO 3.3.0 for AOO 4.1.3
Comment 14 Jean-Baptiste Faure 2019-08-28 07:55:13 UTC
Installing Freetype 2.9.1 from Ubuntu PPA "Better font rendering" solves the problem for me. So it seems that the bug is in Freetype, not in LibreOffice. That said I wonder if it is possible for LibreOffice to protect itself against this external bug ?

Best regards. JBF
Comment 15 Jean-Baptiste Faure 2019-08-28 13:18:50 UTC
Same problem with overbrace.

Best regards. JBF
Comment 16 Xisco Faulí 2019-09-03 10:47:52 UTC
Using GTK3, the UI is broken until https://cgit.freedesktop.org/libreoffice/core/commit/?id=302af8c2da58719844d22483b65a9fe5b3674684, after this commit, the UI is fine but the formula is no longer displayed. I don't think this is a regression...

@Caolán, I thought you might be interested in this issue...
Comment 17 Jean-Baptiste Faure 2019-09-03 14:07:05 UTC
(In reply to Xisco Faulí from comment #16)
> Using GTK3, the UI is broken until
> https://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=302af8c2da58719844d22483b65a9fe5b3674684, after this commit, the UI is
> fine but the formula is no longer displayed. I don't think this is a
> regression...
> 
> @Caolán, I thought you might be interested in this issue...

Hi Xisco,

Which version of Freetype was installed on your computer when you did your tests?

Best regards. JBF
Comment 18 Caolán McNamara 2019-09-03 15:59:10 UTC
I can see this in a VM with Ubuntu 18.04. The render of, I presume the stretched glyph, fails in cairo_show_glyphs and set a cairo_status of @CAIRO_STATUS_FREETYPE_ERROR. Once a cairo context error state is set then it stops drawing and cannot be reset.
Comment 19 Caolán McNamara 2019-09-04 08:58:01 UTC
The freetype commit which fixed this is https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=91015cb41d8f56777f93394f5a60914bc0c0f330
Comment 20 Caolán McNamara 2019-09-04 09:55:52 UTC
I think I can avoid rendering the case that then goes on to ruin subsequent drawing. The brace itself will still disappear when it gets stretched to that breaking point with freetype <= 2.8 but the rest of the drawing will be unaffected.
Comment 21 Commit Notification 2019-09-04 11:46:09 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/df4a6f977843dbf4eb8bb5998b090d92c454611b%5E%21

tdf#127189 FreeType <= 2.8 will fail to render stretched horizontal brace...

It will be available in 6.4.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 22 Caolán McNamara 2019-09-04 19:16:21 UTC
fixed in master, backport to 6-3 in gerrit. Note the brace itself will still fail to appear at a certain stretch after this fix with freetype 2.8, but the rest of rendering is supposed to not then fail
Comment 23 Commit Notification 2019-09-05 12:09:32 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/+/aab09918d349c251e0741263bfe252488690dd97%5E%21

tdf#127189 FreeType <= 2.8 will fail to render stretched horizontal brace...

It will be available in 6.3.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 24 Commit Notification 2019-09-05 12:09:40 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/948d77ec605d9d31047a8e5e34a51303d9cff815%5E%21

tdf#127189 FreeType <= 2.8 will fail to render stretched horizontal brace...

It will be available in 6.2.8.

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.