diff options
author | Henry Castro <hcastro@collabora.com> | 2018-05-06 22:40:05 -0400 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-05-23 13:19:20 +0200 |
commit | a2e6f31c6f90e446d1462e7c80f6b1317f7825bc (patch) | |
tree | 3e009520526d97336d29ba6a45fb1ff22e7b14f5 /sc/source/ui/view/cellsh1.cxx | |
parent | 40cf5a9b3dd619a650a94d8b65bf6987125b75fb (diff) |
tdf#117228: crash in SfxItemSet::GetItemState...
(unsigned short, bool, SfxPoolItem const**) when pasting comment of closed document
Re-work commit 1b7a8277aa3e9f73ccdf15e933a1ee3b42849a44.
In the tiled rendering case, each view has its own clipboard,
but not in desktop version which it has a shared clipboard each view.
Change-Id: I57b1ab81e4c141829dbad899330e5c22204c384a
Reviewed-on: https://gerrit.libreoffice.org/53922
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/ui/view/cellsh1.cxx')
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 896465c74933..feb677e6a335 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1312,9 +1312,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( nFormat != SotClipboardFormatId::NONE ) { - vcl::Window* pWin = GetViewData()->GetActiveWin(); - bool bCells = ( ScTransferObj::GetOwnClipboard( pWin ) != nullptr ); - bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != nullptr ); + bool bCells = ( ScTransferObj::GetOwnClipboard(GetViewData()->GetViewShell()->GetClipData()) != nullptr ); + bool bDraw = ( ScDrawTransferObj::GetOwnClipboard(GetViewData()->GetViewShell()->GetClipData()) != nullptr ); bool bOle = ( nFormat == SotClipboardFormatId::EMBED_SOURCE ); if ( bCells && bOle ) @@ -1338,11 +1337,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScPasteFunc nFunction = ScPasteFunc::NONE; InsCellCmd eMoveMode = INS_NONE; - vcl::Window* pWin = GetViewData()->GetActiveWin(); ScDocument* pDoc = GetViewData()->GetDocument(); bool bOtherDoc = !pDoc->IsClipboardSource(); // keep a reference in case the clipboard is changed during dialog or PasteFromClip - rtl::Reference<ScTransferObj> pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); + const ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(GetViewData()->GetViewShell()->GetClipData()); if ( pOwnClip ) { bool bSkipEmpty = false; @@ -1497,8 +1495,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_PASTE_ONLY_TEXT: case SID_PASTE_ONLY_FORMULA: { - vcl::Window* pWin = GetViewData()->GetActiveWin(); - if ( ScTransferObj::GetOwnClipboard( pWin ) ) // own cell data + if ( ScTransferObj::GetOwnClipboard(GetViewData()->GetViewShell()->GetClipData()) ) // own cell data { rReq.SetSlot( FID_INS_CELL_CONTENTS ); OUString aFlags; @@ -1533,7 +1530,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) bool bRet=true; { WaitObject aWait( GetViewData()->GetDialogParent() ); - bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != nullptr ); + bool bDraw = ( ScDrawTransferObj::GetOwnClipboard(GetViewData()->GetViewShell()->GetClipData()) != nullptr ); if ( bDraw && nFormat == SotClipboardFormatId::EMBED_SOURCE ) pTabViewShell->PasteDraw(); else @@ -1552,7 +1549,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( !pItem ) { - if ( ScTransferObj::GetOwnClipboard( pWin ) ) // own cell data + if ( ScTransferObj::GetOwnClipboard(GetViewData()->GetViewShell()->GetClipData()) ) // own cell data { rReq.SetSlot( FID_INS_CELL_CONTENTS ); ExecuteSlot( rReq, GetInterface() ); @@ -1560,7 +1557,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } else // draw objects or external data { - bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != nullptr ); + bool bDraw = ( ScDrawTransferObj::GetOwnClipboard(GetViewData()->GetViewShell()->GetClipData()) != nullptr ); SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS ); GetPossibleClipboardFormats( aFormats ); |