Bug 53899 - ThisComponent.CurrentController is NULL when first calculating cell formulas
Summary: ThisComponent.CurrentController is NULL when first calculating cell formulas
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.6.1.1 rc
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:5.3.0 target:5.2.0.1
Keywords:
: 37240 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-08-21 23:08 UTC by Jim Avera
Modified: 2016-10-21 15:46 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Demo spreadsheet showing NULL CurrentController at start-up (15.69 KB, application/x-vnd.oasis.opendocument.spreadsheet)
2012-08-21 23:08 UTC, Jim Avera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Avera 2012-08-21 23:08:05 UTC
Created attachment 65919 [details]
Demo spreadsheet showing NULL CurrentController at start-up

In Basic macros, ThisComponent.CurrentController is not being initialized before evaluating formulas in spreadsheet cells the first time after start-up.

Consequently, if a cell formula calls a macro which tries to access the current frame, an error occurs.   After start-up the problem goes away, i.e. 
ThisComponent.CurrentController is defined.

Please open the attached demo .ods file.
Comment 1 Buovjaga 2014-11-06 12:02:38 UTC
Confirmed.

Win 7 64-bit Version: 4.4.0.0.alpha1+
Build ID: 8b21b5cbe78945b27525b4ce78ae3d981f90590f
TinderBox: Win-x86@39, Branch:master, Time: 2014-11-06_03:55:51
Comment 2 Caolán McNamara 2016-05-26 12:45:27 UTC
*** Bug 37240 has been marked as a duplicate of this bug. ***
Comment 3 Caolán McNamara 2016-05-26 12:54:03 UTC
Its basically the ctor of the controller which triggers calculation of the document and the registration is after the controller ctor.

Now the thing that eventually gets set as the controller is created close enough to the calculation, so I guess it could be possible to set it as a temporary controller during the first calculation and unset it again to keep everything "as it was" before that
Comment 4 Caolán McNamara 2016-05-26 13:38:48 UTC
https://gerrit.libreoffice.org/25514 would make this possible, passes make check so plausible I guess
Comment 5 Commit Notification 2016-06-01 11:13:57 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

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

Resolves: tdf#53899 if there is no CurrentController, use the ScTabViewObj

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 6 Commit Notification 2016-06-01 20:13:52 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d44dea9e43c0f9d3b4bada800b1f94a48728f443&h=libreoffice-5-2

Resolves: tdf#53899 if there is no CurrentController, use the ScTabViewObj

It will be available in 5.2.0.1.

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 7 pierre-yves samyn 2016-10-21 15:46:40 UTC
Hi

Verified on windows 7/64 and:

Version: 5.2.0.1 (x64)
Build ID: fcbcb4963bda8633ba72bd2108ca1e802aad557d
CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
Locale: fr-FR (fr_FR)

Version: 5.3.0.0.alpha1+
Build ID: 8a796410ec8f440b4163b15b928347c499da7a8f
CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2016-10-20_23:07:21
Locale: fr-FR (fr_FR); Calc: group

Thank you :)
Regards

Pierre-Yves