Bug 148693 - "Write Error" due to "Curves and Polygons"
Summary: "Write Error" due to "Curves and Polygons"
Status: RESOLVED DUPLICATE of bug 145240
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.3.2.2 release
Hardware: All All
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-20 19:37 UTC by D. Mohr
Modified: 2022-04-22 08:03 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
bt with debug symbols (13.22 KB, text/plain)
2022-04-21 13:30 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description D. Mohr 2022-04-20 19:37:42 UTC
Description:
When drawing with the tool "Curves and Polygons" very short lines, LibreOffice is not able to save the file anymore. Error message:

Error saving the document mydocument:
Write Error.
The file could not be written.

When LibreOffice makes an autosave (after a while), the application CRASHES because it is not able to save anything anymore.

Steps to Reproduce:
1. Open a new sheet in LibreOffice Draw
2. Select the tool "Curves and Polygons"
3. Draw a short line (I mean very short)
4. Click "File" > "Save" and select a random place to save

Actual Results:
LibreOffice is not able to save the file, error message:

Error saving the document mydocument:
Write Error.
The file could not be written.

Expected Results:
Save the file as normal


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
Version: 7.3.2.2 / LibreOffice Community
Build ID: 49f2b1bff42cfccbd8f788c8dc32c1c309559be0
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 1 Julien Nabet 2022-04-21 08:28:30 UTC
In menu Shape/Insert/Curves and Polygons, which option did you choose?

Indeed, on pc Debian x86-64 with master sources updated today, I selected "Curve" Shape/Insert/Curves and Polygons, then I did a very short line and saved, no pb here.
Comment 2 D. Mohr 2022-04-21 13:09:10 UTC
I use at the user interface of LibreOffice Draw "Home">"Curves and Polygons">"Freeform Line".

Drawing short lines with this tool makes Problems at saving the document
Comment 3 Julien Nabet 2022-04-21 13:30:09 UTC
Created attachment 179708 [details]
bt with debug symbols

Thank you for your feedback.
I could reproduce this on pc Debian x86-64 with master sources updated today.
Comment 4 Julien Nabet 2022-04-21 13:30:30 UTC
Regina: thought you might be interested in this one.
Comment 5 Julien Nabet 2022-04-21 13:40:22 UTC
Regina: here's a patch which seems to work:
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 55de243f07aa..9b069a07eb2c 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2338,11 +2338,13 @@ void XMLShapeExport::ImpExportPolygonShape(
     {
         // get PolygonBezier
         uno::Any aAny( xPropSet->getPropertyValue("Geometry") );
-        const basegfx::B2DPolyPolygon aPolyPolygon(
-            basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*o3tl::doAccess<drawing::PolyPolygonBezierCoords>(aAny)));
-
-        if(aPolyPolygon.count())
+        auto pSourcePolyPolygon = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(aAny);
+        if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
         {
+            const basegfx::B2DPolyPolygon aPolyPolygon(
+                basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
+                    *pSourcePolyPolygon));
+
             // complex polygon shape, write as svg:d
             const OUString aPolygonString(
                 basegfx::utils::exportToSvgD(

I took example below line 2789.
Comment 6 Regina Henschel 2022-04-21 16:03:19 UTC
(In reply to Julien Nabet from comment #4)
> Regina: thought you might be interested in this one.

Sorry, I cannot reproduce the problem. That prevents properly fixing. Tested with Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 347622a98f512dae709f938a85498dcdcf9f225a
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: threaded

But from reading your changes, I think it does the correct thing.
Comment 7 Julien Nabet 2022-04-21 16:10:53 UTC
(In reply to Regina Henschel from comment #6)
> (In reply to Julien Nabet from comment #4)
> > Regina: thought you might be interested in this one.
> 
> Sorry, I cannot reproduce the problem. That prevents properly fixing. Tested
> ...
did you try to freeform line AND very short line?
Indeed, if the draw is not enough short and can be considered just as a line, you can't reproduce the pb.

> But from reading your changes, I think it does the correct thing.
ok => https://gerrit.libreoffice.org/c/core/+/133273 thank you!
Comment 8 Regina Henschel 2022-04-21 16:22:01 UTC
(In reply to Julien Nabet from comment #7)
> did you try to freeform line AND very short line?

Yes, I tried. Both with open and closed free form lines, size < 2mm. Saves without problems here.

> ok => https://gerrit.libreoffice.org/c/core/+/133273 thank you!

But you need someone other than me to test it.
Comment 9 D. Mohr 2022-04-21 19:17:34 UTC
(In reply to Julien Nabet from comment #3)
> Created attachment 179708 [details]
> bt with debug symbols
> 
> Thank you for your feedback.
> I could reproduce this on pc Debian x86-64 with master sources updated today.

I hope this comment is not inappropriate:

Thank you so much for all! It is so cool, to have some insights in LibreOffice! I hope I could have helped to locate this bug!
Comment 10 Telesto 2022-04-21 19:28:28 UTC
(In reply to Regina Henschel from comment #6)
> Sorry, I cannot reproduce the problem. 

Strange, I do reproduce it:
Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 4659fc2f0a7223a89446edff0b77e58758b5edf5
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: en-US (nl_NL); UI: en-US
Calc: CL Jumbo

So Windows isn't excluded..
Comment 11 Gabor Kelemen (allotropia) 2022-04-22 06:43:30 UTC
This sounds like bug 145240
Comment 12 Julien Nabet 2022-04-22 08:03:01 UTC
(In reply to Gabor Kelemen (allotropia) from comment #11)
> This sounds like bug 145240

Indeed!

*** This bug has been marked as a duplicate of bug 145240 ***