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

--- Comment #11 from [email protected] ---
Putting a breakpoint on ScViewFunc::PasteFromClip() in
main/sc/source/ui/view/viewfun3.cxx:1237 and stepping into likely functions,
eventually led me to ScColumn::Insert() in
main/sc/source/core/data/column3.cxx:157 as a good place to trace what is
happening.

Now in gdb when I did:

---snip---
(gdb) break ScColumn::Insert
Breakpoint 8 at 0x80e378dba: ScColumn::Insert. (2 locations)
(gdb) commands 8
Type commands for breakpoint(s) 8, one per line.
End with a line saying just "end".
>print *pNewCell
>c
>end
---snip---

so that it prints the cell being passed to ScColumn::Insert(), and then tried
to copy and paste the formula a couple of times, I noticed a difference between
the cases when it correctly pastes the formula, and the cases when it
incorrectly pastes the number.

When it correctly pastes the formula:

---snip---
Thread 1 hit Breakpoint 8.1, ScColumn::Insert (this=this@entry=0x80badec90,
nRow=nRow@entry=11, pNewCell=pNewCell@entry=0x80d7ef480) at
main/sc/source/core/data/column3.cxx:74
74              if (pItems && nCount>0)
$18 = {mpNote = 0x0, mpBroadcaster = 0x0, nTextWidth = 65535, eCellType = 1
'\001', nScriptType = 8 '\b'}

Thread 1 hit Breakpoint 8.1, ScColumn::Insert (this=this@entry=0x80badecc0,
nRow=nRow@entry=11, pNewCell=pNewCell@entry=0x80d7ef4a0) at
main/sc/source/core/data/column3.cxx:74
74              if (pItems && nCount>0)
$19 = {mpNote = 0x0, mpBroadcaster = 0x0, nTextWidth = 65535, eCellType = 1
'\001', nScriptType = 8 '\b'}

Thread 1 hit Breakpoint 8.1, ScColumn::Insert (this=0x80badecf0, nRow=11,
pNewCell=0x80d7f3400) at main/sc/source/core/data/column3.cxx:74
74              if (pItems && nCount>0)
$20 = {mpNote = 0x0, mpBroadcaster = 0x0, nTextWidth = 65535, eCellType = 3
'\003', nScriptType = 8 '\b'}
---snip---

Note how the last case has "eCellType = 3".

In main/sc/inc/global.hxx we have (with numbers added for easy reference):

---snip---
enum CellType
        {
                CELLTYPE_NONE = 0,
                CELLTYPE_VALUE = 1,
                CELLTYPE_STRING = 2,
                CELLTYPE_FORMULA = 3,
                CELLTYPE_NOTE = 4,
                CELLTYPE_EDIT = 5,
                CELLTYPE_SYMBOLS = 6               // fuer Laden/Speichern
#if DBG_UTIL
                ,CELLTYPE_DESTROYED = 7
#endif
        };
---snip---

So that eCellType 3 = CELLTYPE_FORMULA.

When it incorrectly pastes the number, that eCellType is always 1 =
CELLTYPE_VALUE.

In other words, the bad paste is detectable in the code, through the value of
pNewCell->eCellType passed to ScColumn::Insert().

Now when "bt" is added to those gdb breakpoint commands, to print the stack
trace that led to the ScColumn::Insert() call, it also shows some interesting
info which will probably lead to the cause of the bad value, but which I'll
have to continue examining later.

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

Reply via email to