Bug 127748 - crash on modify a frame style, which has previously got writing-mode bt-lr
Summary: crash on modify a frame style, which has previously got writing-mode bt-lr
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.3.0.0.alpha1+
Hardware: All All
: high major
Assignee: Julien Nabet
URL:
Whiteboard: target:6.4.0 target:6.3.3
Keywords: bibisected, bisected, haveBacktrace, needUITest, regression
Depends on:
Blocks:
 
Reported: 2019-09-24 19:48 UTC by Regina Henschel
Modified: 2019-10-01 11:17 UTC (History)
3 users (show)

See Also:
Crash report or crash signature: ["EditResId(char const *)"]


Attachments
"Aufrufliste" (German) from VS2017 (5.43 KB, text/plain)
2019-09-24 19:48 UTC, Regina Henschel
Details
bt Windows (windbg) (110.03 KB, text/plain)
2019-09-25 10:03 UTC, Julien Nabet
Details
sample file (8.46 KB, application/vnd.oasis.opendocument.text)
2019-09-25 11:25 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2019-09-24 19:48:49 UTC
Created attachment 154454 [details]
"Aufrufliste" (German) from VS2017

Start a new document in Writer.
Insert a frame and add some dummy text.
Go to Styles-dialog, section "Frame styles". Right click on "Frame" and then "Modify".
Go to tab "Options" and select "Bottom-to-top, left-to-right (vertical)" from the drop-down list "Text direction". OK
Save the document.
Again, go to Styles-dialog, section "Frame styles". Right click on "Frame" and then "Modify". ==> Crash.

I see the crash in Version: 6.4.0.0.alpha0+ (x64)
Build ID: b2d8093b19642038631dfb8f1ab6745a380a652c
CPU threads: 8; OS: Windows 10.0; UI render: default; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2019-09-23_22:42:37
Locale: de-DE (en_US); UI-Language: en-US
Calc: threaded

"Bottom-to-top, left-to-right (vertical)" is a new feature. You need a current daily build.
Comment 1 IM 2019-09-24 21:59:23 UTC
Thank you for reporting the bug. I can confirm that the bug is present in:

Version: 6.4.0.0.alpha0+ (x86)
Build ID: 5c30c20101f72d973ff28c228f755e635cad14d5
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
Locale: pl-PL (pl_PL); UI-Language: en-US
Calc: threaded

Version: 6.3.1.2 (x64)
Build ID: b79626edf0065ac373bd1df5c28bd630b4424273
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
Locale: pl-PL (pl_PL); UI-Language: en-US
Calc: threaded
Comment 2 Julien Nabet 2019-09-25 10:03:19 UTC
Created attachment 154474 [details]
bt Windows (windbg)

On Win10 with master sources updated today, I could reproduce this.
Comment 3 Xisco Faulí 2019-09-25 11:25:20 UTC
Created attachment 154477 [details]
sample file

Steps to reproduce:
1. Open attached file
2. Select the frame
3. Sidebar - Styles - Frames - Modify

-> Crash
Comment 4 Xisco Faulí 2019-09-25 11:33:14 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=cd2a7acd789297e613424a59b2fe24cedd9a72b6

author	Miklos Vajna <vmiklos@collabora.com>	2019-04-29 20:01:21 +0200
committer	Miklos Vajna <vmiklos@collabora.com>	2019-04-30 09:11:07 +0200
commit cd2a7acd789297e613424a59b2fe24cedd9a72b6 (patch)
tree 31a6051541900d7ed55369d4ac19ee8d779ce68c
parent 267d97ccca46a1c7eb729be7f333e1b8137b8a08 (diff)
sw btlr writing mode: implement ODF filter for textframes

Bisected with: bibisect-linux64-6.3

Adding Cc: to Miklos Vajna
Comment 5 Julien Nabet 2019-09-25 14:16:59 UTC
Pb is in https://opengrok.libreoffice.org/xref/core/editeng/source/items/frmitems.cxx?r=c6c8de5a#3324:
3322  const char* getFrmDirResId(size_t nIndex)
3323  {
3324      const char* const RID_SVXITEMS_FRMDIR[] =
3325      {
3326          RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP,
3327          RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP,
3328          RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT,
3329          RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT,
3330          RID_SVXITEMS_FRMDIR_ENVIRONMENT
3331      };
3332      return RID_SVXITEMS_FRMDIR[nIndex];

When testing, I got nIndex = 5, so out of range.

A new constant must be declared in https://opengrok.libreoffice.org/xref/core/include/editeng/editrids.hrc?r=5f5bfddf#269
269 #define RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP       NC_("RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP", "Text direction left-to-right (horizontal)")
270 #define RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP      NC_("RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP", "Text direction right-to-left (horizontal)")
271 #define RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT      NC_("RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT", "Text direction right-to-left (vertical)")
272 #define RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT       NC_("RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT", "Text direction left-to-right (vertical)")
273 #define RID_SVXITEMS_FRMDIR_ENVIRONMENT         NC_("RID_SVXITEMS_FRMDIR_ENVIRONMENT", "Use superordinate object text direction setting")

I thought about "RID_SVXITEMS_FRMDIR_VERT_BOT_LEFT" but what to put in description?
"Text direction left-to-right (vertical, from bottom)"
Comment 6 Miklos Vajna 2019-09-25 14:45:55 UTC
I planned to get to this in the near future, but if you Julien are faster, it's great. :-)

Your UI string suggestion makes sense to me, it contains the btlr info and is consistent with the other existing strings.
Comment 7 Julien Nabet 2019-09-25 14:56:04 UTC
(In reply to Miklos Vajna from comment #6)
> I planned to get to this in the near future, but if you Julien are faster,
> it's great. :-)
> 
> Your UI string suggestion makes sense to me, it contains the btlr info and
> is consistent with the other existing strings.

Thank you Miklos for your feedback!

Here's a patch:
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 0d49c25681b6..4cb09608cf2e 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3327,7 +3327,8 @@ const char* getFrmDirResId(size_t nIndex)
         RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP,
         RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT,
         RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT,
-        RID_SVXITEMS_FRMDIR_ENVIRONMENT
+        RID_SVXITEMS_FRMDIR_ENVIRONMENT,
+        RID_SVXITEMS_FRMDIR_VERT_BOT_LEFT
     };
     return RID_SVXITEMS_FRMDIR[nIndex];
 }
diff --git a/include/editeng/editrids.hrc b/include/editeng/editrids.hrc
index 983fb2b05c2d..aa95c68f572e 100644
--- a/include/editeng/editrids.hrc
+++ b/include/editeng/editrids.hrc
@@ -271,6 +271,7 @@
 #define RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT      NC_("RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT", "Text direction right-to-left (vertical)")
 #define RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT       NC_("RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT", "Text direction left-to-right (vertical)")
 #define RID_SVXITEMS_FRMDIR_ENVIRONMENT         NC_("RID_SVXITEMS_FRMDIR_ENVIRONMENT", "Use superordinate object text direction setting")
+#define RID_SVXITEMS_FRMDIR_VERT_BOT_LEFT       NC_("RID_SVXITEMS_FRMDIR_VERT_BOT_LEFT", "Text direction left-to-right (vertical from bottom)")
 #define RID_SVXITEMS_PARASNAPTOGRID_ON          NC_("RID_SVXITEMS_PARASNAPTOGRID_ON", "Paragraph snaps to text grid (if active)")
 #define RID_SVXITEMS_PARASNAPTOGRID_OFF         NC_("RID_SVXITEMS_PARASNAPTOGRID_OFF", "Paragraph does not snap to text grid")
 #define RID_SVXITEMS_CHARHIDDEN_FALSE           NC_("RID_SVXITEMS_CHARHIDDEN_FALSE", "Not hidden")


I tested it locally, I don't have the crash with it and the dialog appears.

I'll be able to submit it on gerrit only tonight. If someone wants to do it before, don't hesitate! :-)
Comment 8 Julien Nabet 2019-09-25 16:36:04 UTC
Fix submitted on gerrit here:
https://gerrit.libreoffice.org/#/c/79572/
Comment 9 Commit Notification 2019-09-26 05:53:21 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2a38ec580b3b6ffe11276462547a41c467a51197

tdf#127748: crash on modify a frame style, which has writing-mode bt-lr

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 10 Julien Nabet 2019-09-26 07:21:23 UTC
Backport for 6.3 on gerrit here: https://gerrit.libreoffice.org/#/c/79582/
Comment 11 Commit Notification 2019-09-26 10:06:38 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

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

tdf#127748: crash on modify a frame style, which has writing-mode bt-lr

It will be available in 6.3.3.

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 12 Xisco Faulí 2019-10-01 11:17:41 UTC
Verified in

Version: 6.4.0.0.alpha0+
Build ID: 981654f6e0d57c2c6dd1bbf740a6b67941146497
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-US (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

@Julien Nabet, thanks for fixing this issue!