Bug 103211 - Calc: start/end edit columns can be wrong
Summary: Calc: start/end edit columns can be wrong
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Marco Cecchetti
URL:
Whiteboard: target:5.3.0
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-14 09:57 UTC by Marco Cecchetti
Modified: 2016-10-26 10:51 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
when the cell is double clicked for editing the end edit column is too far (9.92 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-10-14 09:57 UTC, Marco Cecchetti
Details
Visible output area when in-place editing is over (35.19 KB, image/png)
2016-10-14 11:51 UTC, Marco Cecchetti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Cecchetti 2016-10-14 09:57:38 UTC
Created attachment 128001 [details]
when the cell is double clicked for editing the end edit column is too far

It is insane to call EditGrowX/Y while the edit view is growing.

That could occur because of the call to SetDefaultItem later.
We end up with wrong start/end edit columns and the changes
to the output area performed by the inner call to EditGrowX are
useless since they are discarded by the outer call.

In the inner call the output area is not the new one computed by the
outer call, on the contrary the data field `nEditStartCol` and
`nEditEndCol` have been already modified, so the inner call would
modify them using the wrong output area width.

Maybe the call to SetDefaultItem should be performed in another place,
anyway the outer call takes into account the correct horizontal adjust
when computing the new start/end edit columns and the new left/right
output area.

For an example open the attached document: the text edited cell has centered justification but when you double click on it you can see that the edit view output area on the right side is more than needed.
Comment 1 Marco Cecchetti 2016-10-14 10:01:47 UTC
Stack trace where we can see that GrowX ends up invoking itself


Thread 6 "pool" hit Breakpoint 1, ScViewData::EditGrowX (this=0x7f0ef01fd8c8) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/view/viewdata.cxx:1178
1178        ScDocument* pLocalDoc = GetDocument();
(gdb) info stack
#0  0x00007f0ee9cb4b69 in ScViewData::EditGrowX() (this=0x7f0ef01fd8c8) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/view/viewdata.cxx:1178
#1  0x00007f0ee9cb4ade in ScViewData::EditEngineHdl(EditStatus&) (this=0x7f0ef01fd8c8, rStatus=...) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/view/viewdata.cxx:1165
#2  0x00007f0ee9cb4a51 in ScViewData::LinkStubEditEngineHdl(void*, EditStatus&) (instance=0x7f0ef01fd8c8, data=...) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/view/viewdata.cxx:1159
#3  0x00007f0f18d7104d in Link<EditStatus&, void>::Call(EditStatus&) const (this=0x7f0ef04623f8, data=...) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/include/tools/link.hxx:84
#4  0x00007f0f18d6a594 in ImpEditEngine::CallStatusHdl() (this=0x7f0ef0461f80) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/editeng/source/editeng/impedit3.cxx:4058
#5  0x00007f0f18d59b16 in ImpEditEngine::FormatDoc() (this=0x7f0ef0461f80) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/editeng/source/editeng/impedit3.cxx:477
#6  0x00007f0f18d6adf7 in ImpEditEngine::FormatAndUpdate(EditView*) (this=0x7f0ef0461f80, pCurView=0x0) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/editeng/source/editeng/impedit3.cxx:4193
#7  0x00007f0f18d69c74 in ImpEditEngine::SetUpdateMode(bool, EditView*, bool) (this=0x7f0ef0461f80, bUp=true, pCurView=0x0, bForceUpdate=false)
    at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/editeng/source/editeng/impedit3.cxx:3931
#8  0x00007f0f18cd6015 in EditEngine::SetUpdateMode(bool) (this=0x7f0ef0460ae0, bUpdate=true) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/editeng/source/editeng/editeng.cxx:1440
#9  0x00007f0ee932076f in ScEditEngineDefaulter::SetDefaults(SfxItemSet const&, bool) (this=0x7f0ef0460ac0, rSet=..., bRememberCopy=false)
    at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/core/tool/editutil.cxx:505
#10 0x00007f0ee93208ca in ScEditEngineDefaulter::SetDefaultItem(SfxPoolItem const&) (this=0x7f0ef0460ac0, rItem=...) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/core/tool/editutil.cxx:528
#11 0x00007f0ee9cb5703 in ScViewData::EditGrowX() (this=0x7f0ef01fd8c8) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/view/viewdata.cxx:1313
#12 0x00007f0ee9cb4813 in ScViewData::SetEditEngine(ScSplitPos, ScEditEngineDefaulter*, vcl::Window*, short, int) (this=0x7f0ef01fd8c8, eWhich=SC_SPLIT_BOTTOMLEFT, pNewEngine=0x7f0ef0460ac0, pWin=0x7f0ef0200350, nNewX=1, nNewY=9)
    at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/view/viewdata.cxx:1133
#13 0x00007f0ee9c7f211 in ScTabView::MakeEditView(ScEditEngineDefaulter*, short, int) (this=0x7f0ef01fd8c0, pEngine=0x7f0ef0460ac0, nCol=1, nRow=9)
    at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/view/tabview3.cxx:2008
#14 0x00007f0ee9c99626 in ScTabViewShell::Notify(SfxBroadcaster&, SfxHint const&) (this=0x7f0ef01fd850, rBC=..., rHint=...) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/view/tabvwsh5.cxx:189
#15 0x00007f0ee983aa49 in ScDocShell::PostEditView(ScEditEngineDefaulter*, ScAddress const&) (this=0x7f0ef0063120, pEditEngine=0x7f0ef0460ac0, rCursorPos=...)
    at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/docshell/docsh3.cxx:81
#16 0x00007f0ee9727a80 in ScInputHandler::SetMode(ScInputMode, rtl::OUString const*) (this=0x7f0ef0167530, eNewMode=SC_INPUT_TABLE, pInitText=0x0)
    at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/app/inputhdl.cxx:2328
#17 0x00007f0ee9750873 in ScModule::SetInputMode(ScInputMode, rtl::OUString const*) (this=0x7f0ef004cdd0, eMode=SC_INPUT_TABLE, pInitText=0x0)
    at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/app/scmod.cxx:1402
#18 0x00007f0ee9bbfacc in ScGridWindow::MouseButtonUp(MouseEvent const&) (this=0x7f0ef0200350, rMEvt=...) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/view/gridwin.cxx:2429
#19 0x00007f0ee9ac9795 in ScModelObj::postMouseEvent(int, int, int, int, int, int) (this=0x7f0f02855310, nType=1, nX=6660, nY=4455, nCount=2, nButtons=1, nModifier=0)
    at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/sc/source/ui/unoobj/docuno.cxx:619
#20 0x00007f0f1a4c12e0 in doc_postMouseEvent(LibreOfficeKitDocument*, int, int, int, int, int, int) (pThis=0x7f0ef0466450, nType=1, nX=6660, nY=4455, nCount=2, nButtons=1, nModifier=0)
    at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/desktop/source/lib/init.cxx:1859
#21 0x00007f0f2412aa32 in postMouseEventInThread(gpointer) (data=0xf0dde0) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/libreofficekit/source/gtk/lokdocview.cxx:2169
#22 0x00007f0f2412c1c3 in lokThreadFunc(gpointer, gpointer) (data=0xf0dde0) at /opt/shared/work/libreoffice/repo-core/core-cp-5-1-collab-edit/libreofficekit/source/gtk/lokdocview.cxx:2404
#23 0x00007f0f256b150c in  () at /usr/lib64/libglib-2.0.so.0
#24 0x00007f0f256b0b85 in  () at /usr/lib64/libglib-2.0.so.0
#25 0x00007f0f243860a4 in start_thread () at /lib64/libpthread.so.0
#26 0x00007f0f23627cbd in clone () at /lib64/libc.so.6
Comment 2 Marco Cecchetti 2016-10-14 11:51:48 UTC
Created attachment 128003 [details]
Visible output area when in-place editing is over

In gtktiledviewer even with patch 

https://gerrit.libreoffice.org/gitweb?p=core.git;a=commit;h=2cc717877527d0791cf879c3d9b38b967e0f094f 

when in-place editing is over, the redundant part of the output area on the right is not invalidated and repainted.
Comment 3 Commit Notification 2016-10-14 16:00:04 UTC
Marco Cecchetti committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e5e461dd60e7d104f6eb1187949c161372e7b02e

tdf#103211 Calc: it is insane to call EditGrowX/Y while the edit view is growing.

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Eike Rathke 2016-10-26 10:51:02 UTC
Let's set this to fixed then.