Bug 61109 - getCellByPosition failed after removeRange on the same row
Summary: getCellByPosition failed after removeRange on the same row
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected)
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
Whiteboard: bibisected40
Keywords: regression
Depends on:
Reported: 2013-02-19 10:35 UTC by Roman Polach
Modified: 2013-08-19 14:38 UTC (History)
0 users

See Also:
Crash report or crash signature:

The file causing the problem in 3.6.3-4.0.0 (12.33 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-02-19 10:35 UTC, Roman Polach

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Polach 2013-02-19 10:35:51 UTC
Created attachment 75103 [details]
The file causing the problem in 3.6.3-4.0.0

getCellByPosition failed with OutOfRangeException
after removeRange with com.sun.star.sheet.CellDeleteMode.LEFT
is used on range containing other cells on this row.

Attached example: filled cells A1:E8, macro Sub (attached to button)
removes cells D4:F5 with shift to the LEFT, then getting cell A5 failed.

Steps to reproduce:
1) Open attached ods file
2) click the button
If it shows error message, it failed.
If it shows "Everything OK..." then it is ok.

This problem is only in LO 3.6.3, 3.6.4, 3.6.5, 4.0.0.
Not affected releases are: 3.5.6, 3.5.7, 3.6.0, 3.6.1, 3.6.2

So the problem is between 3.6.2 and 3.6.3.
When reading 3.6.3 changelog, could in these lines be something cause this?
fdo#55022 don't access out of bound array index, [Markus Mohrhard]
fdo#55142 fix use proper output offsets. [Sergey Farbotka]
fdo#55156 silly workaround for [Tor Lillqvist]
fdo#55710 don't insert the same pointer twice into a ptr_set, [Markus Mohrhard]
rhbz#689053 fix crash following delete at last table cell: [Michael Stahl]
Comment 1 Roman Polach 2013-02-19 10:36:36 UTC
' content of macro Sub from attached file:

Public Sub TestRemoveRangeProblem
  Dim Brng As New com.sun.star.table.CellRangeAddress
  Dim Cll As Object
  Dim PS As Object
  Dim DL As Object
  On Error Goto problemo
  Set PS = ThisComponent.getSheets()
  Set DL = PS.getByName("Data")
  Brng.Sheet = 0
  Brng.StartColumn = 3
  Brng.EndColumn = 5
  Brng.StartRow = 3
  Brng.EndRow = 5
  DL.removeRange(Brng, com.sun.star.sheet.CellDeleteMode.LEFT)
  Set Cll = DL.getCellByPosition(0, 4)
  MsgBox "Everything is OK, cell (0, 4) has content '" & Cll.String & "'"
  Exit Sub
  Select Case Err
    Case Else
      MsgBox "Error occured: no. " & Err & " - " & Error
      Resume finito
  End Select
End Sub
Comment 2 Roman Polach 2013-02-19 10:41:07 UTC
Does exist some workaround of this problem?
Like some sheet content regeneration that can
be called after removeRange so that subsequent
getCellByPosition do not fail?
Comment 3 Roman Polach 2013-05-14 09:00:03 UTC
Any news to this bug?

It turns all new versions 3.6.3, 3.6.4, 3.6.5, 3.6.6,
4.0.0, 4.0.1, 4.0.2 and 4.0.3 to be totally unusable
for my macro which I desperately need...

Is there any chance to workaround the exception thrown?
Comment 4 Roman Polach 2013-06-17 13:32:04 UTC
Because this is a regression,
I tried bibisect 4.0
and found this hash:

----------------- complete output of last bibisect round ---------------------

6fd77ab0ce2ce86c665515e8cfbcc2e80627a669 is the first bad commit
commit 6fd77ab0ce2ce86c665515e8cfbcc2e80627a669
Author: Bjoern Michaelsen <bjoern.michaelsen@canonical.com>
Date:   Mon Dec 10 13:39:07 2012 +0000

    commit c7692ae82b4c81c2ea8a9e3ee496ee525c0d44f4
    Author:     Michael Stahl <mst@openoffice.org>
    AuthorDate: Tue Sep 18 14:32:48 2012 +0200
    Commit:     Michael Stahl <mst@openoffice.org>
    CommitDate: Tue Sep 18 14:48:02 2012 +0200
        Change-Id: Ibf3dd31f2c213dca83a03773c430de841d2511de

:100644 100644 983e7851c47224bea41e3d09c76aaede40d6f08b 88328886c67c2dcd619a334c86fa7fea250d9dab M	ccache.log
:100644 100644 0397a487b0d9c967652c175cff1dbf0802e50be8 7b7fd4b0e2d09a85393dfc6cf2c44ff3910725ca M	commitmsg
:100644 100644 89e58a1774baaf67c5f9291e99de79fe6d4b41c4 73c5f619ca49063d20f12224321ec33fbfce5701 M	dev-install.log
:100644 100644 5ec7408f2d9973a1aa3d6878b7212a9a8c0f6e0a 311386bf6e72c9c03c00290b9c6c2977ac4fff97 M	make.log
:040000 040000 c315f8f1d6a6346b7f10c136df9b802407a02f9b ddf037f27e0e9562de21ec60c0e34be65431ad90 M	opt

----------------- output of git bisect log -------------------------

# bad: [5b4b36d87517a6ea96ff8c84c46b12f462fc9a1a] source-hash-8450a99c744e9005f19173e4df35d65640bcf5c4
# good: [65fd30f5cb4cdd37995a33420ed8273c0a29bf00] source-hash-d6cde02dbce8c28c6af836e2dc1120f8a6ef9932
git bisect start 'latest' 'oldest'
# good: [16b0b88cbd4ef0f51816e97277e40c5cf78f7bf9] source-hash-099198a4224778fe6e43f5dc13b5b9b1b4dc828c
git bisect good 16b0b88cbd4ef0f51816e97277e40c5cf78f7bf9
# good: [f28b8f9a6c47fa59bf98fffe937a2f2db7a2445a] source-hash-a581d31b227623e09d2970a91214fda398f98eda
git bisect good f28b8f9a6c47fa59bf98fffe937a2f2db7a2445a
# bad: [114fd3b76bcba890e6d702d00cef910f1493c262] source-hash-64ab96cd15e52da88781e720d6f031dbcd0ba902
git bisect bad 114fd3b76bcba890e6d702d00cef910f1493c262
# bad: [6af64581913aa7ce3fcf0890fe671830d416a6ea] source-hash-06a8ca9339f02fccf6961c0de77c49673823b35f
git bisect bad 6af64581913aa7ce3fcf0890fe671830d416a6ea
# good: [f6275e54c182c5a8ed2368418445d84beb165d58] source-hash-d9412fb4755377b8358a46a249cfe29a22ea9451
git bisect good f6275e54c182c5a8ed2368418445d84beb165d58
# bad: [6fd77ab0ce2ce86c665515e8cfbcc2e80627a669] source-hash-c7692ae82b4c81c2ea8a9e3ee496ee525c0d44f4
git bisect bad 6fd77ab0ce2ce86c665515e8cfbcc2e80627a669
# good: [aefa1263d1642e8d9677d385f492530ae0725fc6] source-hash-e63bba0013e5ce34cd04559632206bb7c891eebe
git bisect good aefa1263d1642e8d9677d385f492530ae0725fc6
# good: [0a6c71201d4e6e9cf640d3a06ea7e20b0cabacaa] source-hash-0065e6613b47d7977bbc45d8d8060257390795d0
git bisect good 0a6c71201d4e6e9cf640d3a06ea7e20b0cabacaa
Comment 5 Roman Polach 2013-06-19 11:16:31 UTC
I wanted to get list of git revisions in the result set, following https://wiki.documentfoundation.org/QA/HowToBibisect#How_to_pickup_bugs_that_are_bibisected
but I got an error. What am I doing wrong?

git log 0065e6613b47d7977bbc45d8d8060257390795d0..c7692ae82b4c81c2ea8a9e3ee496ee525c0d44f4

fatal: Invalid revision range 0065e6613b47d7977bbc45d8d8060257390795d0..c7692ae82b4c81c2ea8a9e3ee496ee525c0d44f4
Comment 6 Markus Mohrhard 2013-06-24 20:05:32 UTC
Can't reproduce this bug report in master.
Comment 7 Markus Mohrhard 2013-06-24 20:06:37 UTC
Please don't modify the settings for your own bugs.
Comment 8 Roman Polach 2013-06-25 16:39:30 UTC
Yes, it seems to be ok in (rc1) build ID 1b3956717a60d6ac35b133d7b0a0f5eb55e9155.
Let's hope it will be fixed in 4.1 final.
Comment 9 Markus Mohrhard 2013-06-27 18:11:18 UTC
Seems to be fixed in master/4-1.
Comment 10 Roman Polach 2013-08-19 14:38:13 UTC
Without problem in final