[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice
Subject: Re: kspread 1.2 (stable) crash again, reproducable, long mailing
From: Philipp =?iso-8859-15?q?M=FCller?= <philipp.mueller () gmx ! de>
Date: 2002-10-20 19:18:02
[Download RAW message or body]
Hello Sepp,
Am Sonntag, 20. Oktober 2002 11:50 schrieb Sepp Käsbauer:
> I am not shure if i am the only one who get crashes when working with
> kspread 1.2 ??
No, see at least BRs #47214, #47378, #48540, #48557, #48873, #49288, #49321
I'm not absolutely sure if every crash has the same reason, but it seems to
be. So I'm investigating it now.
> All my crashes have to do with merged cells.
Yes, it crashes within a loop through merged cells information, which is
basically the same as when text overlaps to the next cell (this is also
"merging").
> yesterday i installed the source from cdrom and compiled with debuging
> enabled. when running kspread in ddd i get allways a crash at the same
> point.
>
> The file is kspread_cell.cc allways in line 93 the functioncall
>
> if ( isDefault () )
> coming from line 1939: QPoint obscuringCellRef( obscuringCell->column(),
> obscuringCell->row() );
This is a very nasty bug, which we hoped to have it solved in the last days
before 1.2final. Don't seem to be, I also get it with current
KOFFICE_1_2_BRANCH in cvs in the case you describe to reproduce.
Are you sure it comes to the following point you describe?
> ---------------------- cut -----------------------------
> 85 clearAllErrors();
> 86 }
> 87
> 88 int KSpreadCell::row() const
> 89 {
> 90 /* Make sure this isn't called for the default cell. This assert
> can save you
> 91 (could have saved me!) the hassle of some very obscure bugs.
> 92 */
> 93 if ( isDefault() ) <<<<<<<<<<---------crash
> 94 {
> 95 kdWarning(36001) << "Error: Calling KSpreadCell::row() for default
> cell" << endl;
> 96 return 0;
> 97 }
> 98 return m_iRow;
> 99 }
> 100
For me, the cell itself in obscuringCell->column() is not valid, so calling
->column() with a non valid pointer leads to the crash. This is what we had
when we investigated it.
> To reproduce a crash do the following:
> -start with new sheet
> -select a1 to c3
> -merge cells
> -select the cell, right mouse
> -cell format, position,
> now take the slider cell-width and
> enlarge the cell---->>> crash
As said already, crashed with current KOFFICE_1_2_0 as well here.
I can only assume at the moment where the reason for the non valid cell
references come from. I assume it's when we paint the obscuring cell and this
cell has an update, then the iterator list is rewritten or the cell is
replaced somewhere.
I hacked a bit arround. At least it avoids the non void cells within the
iterator.
Can you test the attached "hackish" patch?
It basically copies before the cell* iterator all cell references to a list of
cells (here QPoints with x=column and y = row). Then it loops through this
valuelist and uses the table->cellAt() to get valid cell references.
This fixes the crash for me but may have other problems.
If you prefer a different style (maybe QPoints are too much), feel free to get
involved ;-)
Philipp
["kspread_patch_obscured_cells.patch" (text/x-diff)]
Index: kspread_cell.cc
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_cell.cc,v
retrieving revision 1.447.2.4
diff -u -r1.447.2.4 kspread_cell.cc
--- kspread_cell.cc 2002/10/07 20:10:15 1.447.2.4
+++ kspread_cell.cc 2002/10/20 19:00:45
@@ -1940,9 +1940,36 @@
while already drawing the obscuring cell -- don't want to cause an
infinite loop
*/
- // Determine the dimension of the cell.
+
+ QValueList<QPoint> listPoints;
QValueList<KSpreadCell*>::iterator it = m_ObscuringCells.begin();
QValueList<KSpreadCell*>::iterator end = m_ObscuringCells.end();
+ for ( ; it != end; ++it )
+ {
+ KSpreadCell *obscuringCell = *it;
+ listPoints.append( QPoint( obscuringCell->column(), obscuringCell->row() ) );
+ }
+
+ QValueList<QPoint>::iterator it1 = listPoints.begin();
+ QValueList<QPoint>::iterator end1 = listPoints.end();
+ for ( ; it1 != end1; ++it1 )
+ {
+ QPoint obscuringCellRef = *it1;
+ KSpreadCell *obscuringCell = m_pTable->cellAt( obscuringCellRef.x(), obscuringCellRef.y() );
+ double x = m_pTable->dblColumnPos( obscuringCellRef.x() );
+ double y = m_pTable->dblRowPos( obscuringCellRef.y() );
+ QPair<double,double> corner = qMakePair( x, y );
+ painter.save();
+
+ obscuringCell->paintCell( rect, painter, view,
+ corner, obscuringCellRef );
+ painter.restore();
+ }
+
+
+ // Determine the dimension of the cell.
+/* QValueList<KSpreadCell*>::iterator it = m_ObscuringCells.begin();
+ QValueList<KSpreadCell*>::iterator end = m_ObscuringCells.end();
for ( ; it != end; ++it ) {
KSpreadCell *obscuringCell = *it;
QPoint obscuringCellRef( obscuringCell->column(), obscuringCell->row() );
@@ -1954,7 +1981,7 @@
obscuringCell->paintCell( rect, painter, view,
corner, obscuringCellRef );
painter.restore();
- }
+ }*/
}
clearFlag( Flag_PaintingCell );
____________________________________
koffice mailing list
koffice@mail.kde.org
To unsubscribe please visit:
http://mail.kde.org/mailman/listinfo/koffice
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic