Bug 158833 - Deleting a sheet destroys the variable containing the reference to the other sheet.
Summary: Deleting a sheet destroys the variable containing the reference to the other ...
Status: RESOLVED DUPLICATE of bug 158223
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.4.1 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-22 13:18 UTC by Vladimir Sokolinskiy
Modified: 2023-12-22 14:01 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Sokolinskiy 2023-12-22 13:18:11 UTC
Run macro (on a clean profile):

Sub Test
 Dim oDoc, oSheets, oSheet
 oDoc = StarDesktop.LoadComponentFromUrl("private:factory/scalc", "_blank", 0, Array())
 oSheets=oDoc.Sheets
 oSheets(0).Name="Sheet1"
 Do While oSheets.Count<3
   oSheets.insertNewByName "Sheet" & (oSheets.Count+1), oSheets.Count
 Loop  
 
 ' The document now contains 3 sheets: Sheet1, Sheet2, Sheet3
 oSheet=oSheets.getByName("Sheet2")
 oSheets.removeByName("Sheet3")
 Msgbox oSheet.AbsoluteName  ' Shows: $Sheet2.$A$1:$Sheet1.$XFD$1048576
End Sub

Result: the unthinkable $Sheet2.$A$1:$Sheet1.$XFD$1048576

In 7.4.3.2 version the result is normal: $Sheet2.$A$1:$XFD$1048576
Comment 1 Stéphane Guillou (stragu) 2023-12-22 13:53:22 UTC
Thanks for the report.
I suspect this is the same issue as bug 158223, which should be fixed in the next bugfix version, 7.6.5.
Can please confirm this with testing either:
- a daily build of 7.6.5: https://dev-builds.libreoffice.org/daily/libreoffice-7-6/
- a current master build: https://dev-builds.libreoffice.org/daily/master/current.html

Thank you!
Comment 2 Stéphane Guillou (stragu) 2023-12-22 13:56:11 UTC
Actually, I just tested your macro and can confirm that it is broken in 7.6.4.1 but resolved in a current master build.
So I'll go ahead and mark as a duplicate :)

*** This bug has been marked as a duplicate of bug 158223 ***
Comment 3 Vladimir Sokolinskiy 2023-12-22 14:01:35 UTC
Stéphane, thanks a lot!