https://bugs.documentfoundation.org/show_bug.cgi?id=172045
Bug ID: 172045
Summary: EDITING: Duplication (Shift+F3) fails on flat
1-dimensional horizontal or vertical lines
Product: LibreOffice
Version: 26.2.3.2 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Draw
Assignee: [email protected]
Reporter: [email protected]
Description:
======================================================================
BUG REPORT: DUPLICATION FAILS ON 1-DIMENSIONAL STRAIGHT LINES (DRAW/SVX)
======================================================================
[SUMMARY]
EDITING: Duplication command (Shift+F3) fails silently on perfectly
vertical (width=0) or perfectly horizontal (height=0) lines.
[AFFECTED APPLICATIONS]
Confirmed in LibreOffice Draw, but likely impacts Writer, Calc, and
Impress due to the shared underlying vector drawing engine (svx).
[REPRODUCIBILITY]
100% Reproducible.
[STEPS TO REPRODUCE]
1. Open LibreOffice Draw.
2. Select the "Insert Line" tool. Hold down the SHIFT key to constrain the
angle, and draw a perfectly vertical straight line.
3. Select the drawn line and choose Edit -> Duplicate (or press Shift+F3).
4. Keep the default values in the Duplicate dialog box and click "OK".
5. Note that no duplicate object is generated.
6. Now, repeat the test using the SHIFT key to draw a perfectly horizontal
line.
7. Attempt to duplicate it; note that it fails identically.
8. Workaround/Delta Test: Rotate either line by a fraction of a degree
(so that width > 0 and height > 0). Run the duplicate command again.
The duplication now succeeds perfectly.
[EXPECTED RESULT]
The engine should calculate the offset positioning and successfully generate
a duplicated line object, regardless of whether the width or height of the
bounding box is zero.
[ACTUAL RESULT]
The duplication routine drops out silently. No duplicate line is rendered,
and no user-facing error message is displayed.
[DEVELOPER ANALYSIS & CODE POINTERS]
The root cause is a classic matrix degradation or division-by-zero anomaly
within the core drawing engine (`svx`).
When an object is duplicated, the engine fetches its dimensions using
`SdrObject::GetSnapRect()`. For pure 1-dimensional lines, one axis
evaluates to exactly 0.
The scaling mathematical pipeline in `core/svx/source/svdraw/svdopath.cxx`
(specifically within `SdrPathObj::NbcSetSnapRect`) likely attempts to
calculate relative axis scale factors (`fResizeX` / `fResizeY`). This triggers
an unhandled division by zero, yielding an invalid `NaN` or `Inf` state inside
the `basegfx::B2DHomMatrix` matrix structure.
[PROPOSED RESOLUTION LOGIC]
An epsilon fallback check should be injected into the resize evaluation path
to guard against zero-width or zero-height lines. If a dimension is zero,
the scaling calculation should safely default to unity (1.0) instead of
dividing.
Example check:
if (::basegfx::fTools::equalZero(aOld.GetWidth()) ||
::basegfx::fTools::equalZero(aOld.GetHeight()))
{
fResizeX = 1.0;
fResizeY = 1.0;
}
======================================================================
Steps to Reproduce:
1. Open LibreOffice Draw.
2. Select the "Insert Line" tool. Hold down the SHIFT key to constrain the
angle, and draw a perfectly vertical straight line.
3. Select the drawn line and choose Edit -> Duplicate (or press Shift+F3).
4. Keep the default values in the Duplicate dialog box and click "OK".
5. Note that no duplicate object is generated.
6. Now, repeat the test using the SHIFT key to draw a perfectly horizontal
line.
7. Attempt to duplicate it; note that it fails identically.
8. Workaround/Delta Test: Rotate either line by a fraction of a degree
(so that width > 0 and height > 0). Run the duplicate command again.
The duplication now succeeds perfectly.
Actual Results:
The duplication routine drops out silently. No duplicate line is rendered,
and no user-facing error message is displayed.
Expected Results:
The engine should calculate the offset positioning and successfully generate
a duplicated line object, regardless of whether the width or height of the
bounding box is zero.
Reproducible: Always
User Profile Reset: No
Additional Info:
Na
--
You are receiving this mail because:
You are the assignee for the bug.