Bug 98856 - Can't drag an empty textbox
Summary: Can't drag an empty textbox
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
5.0.5.2 release
Hardware: All All
: medium major
Assignee: Chris Sena
URL:
Whiteboard: target:26.8.0 target:26.2.3
Keywords:
Depends on:
Blocks: Textbox
  Show dependency treegraph
 
Reported: 2016-03-24 09:18 UTC by Samuel Mehrbrodt
Modified: 2026-03-10 10:50 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
tests (5.94 KB, image/png)
2026-03-08 02:14 UTC, Chris Sena
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Mehrbrodt 2016-03-24 09:18:08 UTC
1. Create a new empty text box
2. Try to drag it around (before entering text in it)
3. The text box vanishes
Comment 1 steve 2016-03-24 09:27:42 UTC
Confirmed w below → NEW

Version: 5.2.0.0.alpha0+
Build ID: 7ccdb94e2c5774f924bf89b34387c7d41e2e4c30
CPU Threads: 4; OS Version: Mac OS X 10.11.4; UI Render: default; 
TinderBox: MacOSX-x86_64@49-TDF, Branch:master, Time: 2016-03-03_02:42:27
Locale: de-DE (de.UTF-8)
Comment 2 Oliver Specht (CIB) 2016-03-24 11:06:35 UTC
This is not (necessarily) a bug. It was a design decision to remove empty text objects because otherwise you might fill you document unintentionally with unused, empty and mostly invisible objects without noticing.
Comment 3 V Stuart Foote 2016-03-24 13:22:02 UTC
Kind of agree that this is not a bug.

Doing cleanup of not completing creation of the text box object until some text is actually entered, or deletion when emptied (as with a cut-paste) makes sense. 

Not being able to reposition during creation is a bit annoying, but compared to littering the canvas with empty text boxes (invisible and no means to select) it seems a reasonable design. 

Those orphaned objects are a real nuisance in some other programs that do have selection ability--Illustrator or Photoshop for example.
Comment 4 Telesto 2016-12-31 09:44:21 UTC
Have found work-around (or a bug) related to this one.
1. Create a new empty text box (and let it 'activated')
2. Press CTRL+Z
3. Click at the position of the text box (it still there)

Personally I would prefer that i'm able to drag an empty textbox. It's counter intuitive at this point. But if the are fully invisible it useless of course.
Comment 5 QA Administrators 2018-01-01 03:26:41 UTC Comment hidden (obsolete)
Comment 6 sdc.blanco 2020-01-22 13:43:17 UTC
(In reply to Telesto from comment #4)
> Have found work-around (or a bug) related to this one.
> 1. Create a new empty text box (and let it 'activated')
> 2. Press CTRL+Z
> 3. Click at the position of the text box (it still there)
> 
> Personally I would prefer that i'm able to drag an empty textbox. It's
> counter intuitive at this point. But if the are fully invisible it useless
> of course.
Still works in 6.3.4.2.  They appear in Navigator (Drawing Objects), where you can double-click to get them back (also to drag and insert text).

FWIW - as user, was often frustrated when trying to drag empty textboxes (i.e. sympathy for OP).  Learned to put single character as workaround.

Proposal for alternative behavior:  
   If ((new empty text box) && drag))
   then keep   (i.e., added to Navigator, like Ctrl-Z)
   else Drop   (current behavior)

(Assumption is: user dragging an empty textbox is going to insert immediately afterwards, minimizing "orphan" problem from comment #2.)

Should this bug have "major" importance?
Comment 7 QA Administrators 2022-01-22 03:56:27 UTC Comment hidden (obsolete)
Comment 8 sdc.blanco 2022-01-22 13:15:25 UTC
repro

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: bb29b12a9e367d181a5d9d962d466df41e093e0c
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: da-DK (da_DK); UI: en-US
Calc: CL
Comment 9 QA Administrators 2024-01-23 03:12:16 UTC Comment hidden (obsolete)
Comment 10 QA Administrators 2026-01-29 10:22:41 UTC Comment hidden (obsolete)
Comment 11 Chris Sena 2026-02-23 04:18:11 UTC
Confirmed on Windows 11 and Local Master (26.2).
Tested against the installed version 7.6.2.1 and verified the logic remains unchanged in the current master branch.

Local Environment Info:
LIBO_VERSION_MAJOR: 26
OS: Windows 10.0 Build 26200 (WSL2/Ubuntu)

Next Steps:
I am reverse-engineering the SdrTextObj interaction to prevent the "Delete if Empty" logic from firing during a drag attempt.
Comment 12 Chris Sena 2026-03-07 01:30:06 UTC
Still working this to determine where the box is being ghosted.
Comment 13 Chris Sena 2026-03-08 02:14:30 UTC
Created attachment 205998 [details]
tests

Evidence of the box persisting.
Comment 14 Chris Sena 2026-03-08 02:14:42 UTC
Root Cause Analysis:
The bug is a result of a Use-Before-Preserve / Premature Object Destruction race condition.
During a mouse-drag event on an empty text box, the SdrEndTextEdit function triggers a cleanup/destruction path because it determines the object is empty. However, the subsequent BegDragObj subsystem still requires a valid pointer to that same SdrObject to process the drag. Because the destruction is sequenced before the drag operation is fully initialized in the event handler, the system attempts to operate on a null/deallocated pointer.

Proposed Fix:
I have implemented a guard in the deletion path of SdrEndTextEdit to ensure that SdrTextObj instances remain valid if a drag operation is pending or initiated within the same event dispatch. This maintains the existing design goal (preventing orphan objects) while allowing the UI to respond to user intent during creation.
Comment 15 Chris Sena 2026-03-08 04:24:13 UTC
Fix submitted: https://gerrit.libreoffice.org/c/core/+/201201
Comment 16 Commit Notification 2026-03-09 08:04:35 UTC
Chris committed a patch related to this issue.
It has been pushed to "master":

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

tdf#98856: sd: preserve empty text frame when dragging it

It will be available in 26.8.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 17 Samuel Mehrbrodt 2026-03-09 10:28:07 UTC
Thanks Chris!
Comment 18 Commit Notification 2026-03-10 10:50:18 UTC
Chris committed a patch related to this issue.
It has been pushed to "libreoffice-26-2":

https://git.libreoffice.org/core/commit/57663bb21d2215373815b3e1903cb50c732f6d09

tdf#98856: sd: preserve empty text frame when dragging it

It will be available in 26.2.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.