https://bz.apache.org/ooo/show_bug.cgi?id=128612

--- Comment #12 from [email protected] ---
When for the gdb breakpoint I did:

---snip---
(gdb) commands 8
Type commands for breakpoint(s) 8, one per line.
End with a line saying just "end".
>print *pNewCell
>bt
>c
>end
(gdb) c
---snip---

which allowed me to see stack trace for each call to ScColumn::Insert(), and
then began comparing a working paste stack trace and a broken paste stack trace
to each other, in order from the most recently called function first, the first
major difference I saw was this:

WORKING:
#7  0x000000081034d204 in ScCellShell::PasteFromClipboard (pViewData=<optimized
out>, pTabViewShell=pTabViewShell@entry=0x80d080810, bShowDialog=true)
    at main/sc/source/ui/view/cellsh1.cxx:2193

BROKEN:
#10 0x000000081034d216 in ScCellShell::PasteFromClipboard
(pViewData=0x80d080898, pTabViewShell=pTabViewShell@entry=0x80d080810,
bShowDialog=true)
    at main/sc/source/ui/view/cellsh1.cxx:2184

Now what is that ScCellShell::PasteFromClipboard() function doing?

   2151 void ScCellShell::PasteFromClipboard( ScViewData* pViewData,
ScTabViewShell* pTabViewShell, bool bShowDialog )
   2152 {
   2153     Window* pWin = pViewData->GetActiveWin();
   2154     ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
   2155     ScDocument* pThisDoc = pViewData->GetDocument();
   2156     ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( pViewData->GetCurX(),
   2157                          pViewData->GetCurY(), pViewData->GetTabNo() );
   2158     if ( pOwnClip && pDPObj )
   2159     {
   2160         // paste from Calc into DataPilot table: sort (similar to drag
& drop)
                ...
   2178     }
   2179     else
   2180     {
   2181         // normal paste
   2182         WaitObject aWait( pViewData->GetDialogParent() );
   2183         if (!pOwnClip)
// BROKEN: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
   2184             pTabViewShell->PasteFromSystem();
// BROKEN: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   2185         else
   2186         {
   2187             ScDocument* pClipDoc = pOwnClip->GetDocument();
   2188             sal_uInt16 nFlags = IDF_ALL;
   2189             if (pClipDoc->GetClipParam().isMultiRange())
   2190                 // For multi-range paste, we paste values by default.
   2191                 nFlags &= ~IDF_FORMULA;
   2192 
// WORKING: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
   2193             pTabViewShell->PasteFromClip( nFlags, pClipDoc,
   2194                     PASTE_NOFUNC, sal_False, sal_False, sal_False,
INS_NONE, IDF_NONE,
   2195                     bShowDialog );      // allow warning dialog
// WORKING: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   2196         }
   2197     }
   2198     pTabViewShell->CellContentChanged();        // => PasteFromSystem()
???
   2199 }


So in the working case, pTabViewShell->PasteFromClip() is called, while in the
broken case, pTabViewShell->PasteFromSystem() is called.

And the reason for the different behaviour is the different value of pOwnClip:

   2183         if (!pOwnClip)

which came from:

   2154     ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );

So OpenOffice is failing to distinguish when to use its own clipboard vs the
system clipboard, and wrongly pasting from the system clipboard in the broken
cases.

But why is this happening? At present I suspect some other running application,
such as a clipboard manager (or any other application), is messing around with
the clipboard, confusing OpenOffice. But I'll need to debug further to confirm.

-- 
You are receiving this mail because:
You are the assignee for the issue.

Reply via email to