sc/source/core/data/documen2.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
New commits: commit c9b828dd75961e22da276471f18a3aab1b87ffbc Author: Julien Nabet <serval2...@yahoo.fr> Date: Sun Apr 24 20:54:28 2016 +0200 tdf#99479: Delete column with styles resets the 'Apply Style' drop down To start, the problem appears in SvxStyleToolBoxControl::FillStyleBox() pStyleSheetPool->First() returns null to pStyle because pStyleSheetPool is empty so we don't enter in while ( pStyle ) and can't add non default styles So why pStyleSheetPool is empty? pStyleSheetPool comes from pPool (SvxStyleToolBoxControl::Update()), pPool is retrieved from pDocShell->GetStyleSheetPool() (=> static_cast<SfxStyleSheetBasePool*>(aDocument.GetStyleSheetPool())) which is retrieved from xPoolHelper->GetStylePool(); ScDocument::GetStyleSheetPool() Let's move on, why xPoolHelper is empty? it's because when we delete the column, it does 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 But calling delete on pRefUndoDoc shouldn't call SourceDocumentGone since it's been created as a ScDocument with SCDOCMODE_UNDO eMode not with "SCDOCMODE_DOCUMENT" eMode. Since xPoolHelper is instantiated when only "SCDOCMODE_DOCUMENT" eMode (see http://opengrok.libreoffice.org/xref/core/sc/source/core/data/documen2.cxx#224), only destructor call of a document with eMode "SCDOCMODE_DOCUMENT" should be able to destroy xPoolHelper So the fix is only to call PoolHelper->SourceDocumentGone(); when (xPoolHelper.is() && !bIsClip) but also if !bIsUndo Change-Id: I1089d20264d0594c7e8ebe9263ebad6e68485c12 Reviewed-on: https://gerrit.libreoffice.org/24345 Tested-by: Jenkins <c...@libreoffice.org> Tested-by: Yousuf Philips <philip...@hotmail.com> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> (cherry picked from commit a7b4a0a9f387310832cce7a6850ec438ce03b31e) Reviewed-on: https://gerrit.libreoffice.org/24792 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index f436363..97607d4 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -422,7 +422,7 @@ ScDocument::~ScDocument() // delete the EditEngine before destroying the xPoolHelper delete pCacheFieldEditEngine; - if ( xPoolHelper.is() && !bIsClip ) + if ( xPoolHelper.is() && !bIsClip && !bIsUndo) xPoolHelper->SourceDocumentGone(); xPoolHelper.clear();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits