Bug 99479 - Delete column with styles resets the 'Apply Style' drop down
Summary: Delete column with styles resets the 'Apply Style' drop down
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:5.2.0 target:5.1.4
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-24 12:51 UTC by Yousuf Philips (jay) (retired)
Modified: 2016-10-25 19:01 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
sample (7.66 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-04-24 12:51 UTC, Yousuf Philips (jay) (retired)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Philips (jay) (retired) 2016-04-24 12:51:14 UTC
Created attachment 124602 [details]
sample

Steps:
1) Open attached file
2) Make sure the 'Apply Style' drop down menu is visible in the formatting toolbar or sidebar
3) Notice the two custom styles 'Test' and 'Test 2' are listed in the drop down
4) Select and delete column D
5) Notice that the 'Apply Style' drop down has now been reset and both custom styles are missing
6) Apply any of the two custom styles to any other cells and they wont be reappear in the drop down list

Saw this mentioned here, so confirming it is in LO as well.
https://twitter.com/WhitePhoenixUS/status/724019403868745730

With this broken, the drop down menu is quite useless as a user would always need to styles and formatting tab.

Version: 5.2.0.0.alpha0+
Build ID: 92d7fef02574051826e46a3a7e3d33a1afa062d7
CPU Threads: 2; OS Version: Linux 4.2; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-04-14_03:19:54
Locale: en-US (en_US.UTF-8)
Comment 1 pierre-yves samyn 2016-04-24 13:17:29 UTC
Hi

Reproduced on windows 7/64 & Version: 5.2.0.0.alpha1 (x64)
Build ID: 902b28a39528b6c92602e9b521a1d0861be1caf9
CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
Locale: fr-FR (fr_FR

I set status to New

Regards
Pierre-Yves
Comment 2 Julien Nabet 2016-04-24 15:03:24 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

Pool of styles is emptied with this:
#0  ScPoolHelper::SourceDocumentGone (this=0x2c006c0) at /home/julien/lo/libreoffice/sc/source/core/data/poolhelp.cxx:116
#1  0x00002aaad4e28eae in ScDocument::~ScDocument (this=0x8d6ac40, __in_chrg=<optimized out>) at /home/julien/lo/libreoffice/sc/source/core/data/documen2.cxx:426
#2  0x00002aaad57a85f8 in ScDocFunc::DeleteCells (this=0x2c04bb0, rRange=..., pTabMark=0x3231ad0, eCmd=DEL_DELCOLS, bApi=false)
    at /home/julien/lo/libreoffice/sc/source/ui/docshell/docfunc.cxx:2415
#3  0x00002aaad5cfa0f3 in ScViewFunc::DeleteCells (this=0x3230fd8, eCmd=DEL_DELCOLS) at /home/julien/lo/libreoffice/sc/source/ui/view/viewfunc.cxx:1512
Comment 3 Yousuf Philips (jay) (retired) 2016-04-24 17:33:03 UTC
The issue is also reported here - https://bz.apache.org/ooo/show_bug.cgi?id=98998#c3
Comment 4 Julien Nabet 2016-04-24 17:56:13 UTC
With this patch, I don't reproduce this:
diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx
index 40bae0a..8aa6f86 100644
--- a/sc/source/core/data/poolhelp.cxx
+++ b/sc/source/core/data/poolhelp.cxx
@@ -113,7 +113,7 @@ SvNumberFormatter* ScPoolHelper::CreateNumberFormatter() const
 void ScPoolHelper::SourceDocumentGone()
 {
     //  reset all pointers to the source document
-    mxStylePool->SetDocument( nullptr );
+    mxStylePool->SetDocument( m_pSourceDoc );
     if ( pFormTable )
         pFormTable->SetColorLink( Link<sal_uInt16,Color*>() );
 }

However, giving a try to gdb, mxStylePool->GetDocument() retrieved the same as m_pSourceDoc, see this:
Breakpoint 1, ScPoolHelper::SourceDocumentGone (this=0x2c20e30) at /home/julien/lo/libreoffice/sc/source/core/data/poolhelp.cxx:116
116	    mxStylePool->SetDocument( m_pSourceDoc );
(gdb) p m_pSourceDoc
$1 = (ScDocument *) 0x2c21160
(gdb) p mxStylePool->GetDocument()
[Thread 0x2aaafd5b8700 (LWP 3545) exited]
$2 = (ScDocument *) 0x2c21160

However, I don't know if it's just for this case or if it's always the case (and so , the patch should be just remove "mxStylePool->SetDocument( nullptr );")

Eike: any thought?
Comment 5 Julien Nabet 2016-04-24 19:00:52 UTC
I submitted a patch on master sources to review here:
https://gerrit.libreoffice.org/24345
It'll allow
1) to check if it's ok for all envs
2) to discuss about it more easily
Comment 6 Julien Nabet 2016-04-24 21:47:38 UTC
Since the patch is wrong, I'll unassign myself since I've got no idea how to fix this.
Comment 7 Yousuf Philips (jay) (retired) 2016-04-24 22:13:50 UTC
Thanks for trying Julien. :D
Comment 8 Commit Notification 2016-05-09 08:53:18 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

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

tdf#99479: Delete column with styles resets the 'Apply Style' drop down

It will be available in 5.2.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 10 Julien Nabet 2016-05-10 09:46:06 UTC
Gerrit review for 5.0 branch here: https://gerrit.libreoffice.org/#/c/24793/
Comment 11 Daniël van Vuuren 2016-06-03 14:52:13 UTC
Verified fix in:

Version: 5.3.0.0.alpha0+
Build ID: 6b3b352b06d92ef20194b9a992a521af2ef07b48
CPU Threads: 2; OS Version: Linux 4.4; UI Render: default; 
TinderBox: Linux-rpm_deb-x86@71-TDF, Branch:master, Time: 2016-06-03_01:35:48

Version: 5.2.0.0.beta1+
Build ID: b6230835b927e0053687fae6026fa3603600f321
CPU Threads: 2; OS Version: Linux 4.4; UI Render: default; 
TinderBox: Linux-rpm_deb-x86@71-TDF, Branch:libreoffice-5-2, Time: 2016-06-03_02:09:38

Version: 5.1.5.0.0+
Build ID: 1245bead3a68c9495a870f194f3c523b3b78cf87
CPU Threads: 2; OS Version: Linux 4.4; UI Render: default; 
TinderBox: Linux-rpm_deb-x86@71-TDF, Branch:libreoffice-5-1, Time: 2016-06-02_04:43:39