author | mickeyl <mickeyl> | 2003-05-02 22:56:35 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-02 22:56:35 (UTC) |
commit | 5ca7f12dab929b21c133f785a3328c949df69401 (patch) (side-by-side diff) | |
tree | 483e834905954a6b63cdd7ae1491474f365ddcf3 | |
parent | 9325b8e82d2cf1df1233bcfb21d91f61f8e444a3 (diff) | |
download | opie-5ca7f12dab929b21c133f785a3328c949df69401.zip opie-5ca7f12dab929b21c133f785a3328c949df69401.tar.gz opie-5ca7f12dab929b21c133f785a3328c949df69401.tar.bz2 |
fix a long standing bug and hard to reproducable bug where wellenreiter segfaulted,
but just if you played the "open/close-game" with the items and subitems
Note to self: QListViewItem::itemBelow() != QListViewItem::nextSibling() !!!
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 7733934..b8aa81c 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -110,52 +110,34 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo channel ); // search, if we already have seen this net QString s; MScanListItem* network; MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); - while ( item && ( item->text( 0 ) != essid ) ) + while ( item && ( item->text( col_essid ) != essid ) ) { - qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); - item = static_cast<MScanListItem*> ( item->itemBelow() ); + qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); + item = static_cast<MScanListItem*> ( item->nextSibling() ); } if ( item ) { - // animate the item - - /* - - const QPixmap* pixmap = item->pixmap( 0 ); - const QPixmap* nextpixmap = ani2; - if ( pixmap == ani1 ) - nextpixmap = ani2; - else if ( pixmap == ani2 ) - nextpixmap = ani3; - else if ( pixmap == ani3 ) - nextpixmap = ani4; - else if ( pixmap == ani4 ) - nextpixmap = ani1; - item->setPixmap( 0, *nextpixmap ); */ - - //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap ); - // we have already seen this net, check all childs if MAC exists network = item; item = static_cast<MScanListItem*> ( item->firstChild() ); assert( item ); // this shouldn't fail - while ( item && ( item->text( 2 ) != macaddr ) ) + while ( item && ( item->text( col_ap ) != macaddr ) ) { - qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); - item = static_cast<MScanListItem*> ( item->itemBelow() ); + qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); + item = static_cast<MScanListItem*> ( item->nextSibling() ); } if ( item ) { // we have already seen this item, it's a dupe #ifdef DEBUG qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); #endif @@ -194,17 +176,17 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo void MScanListView::addIfNotExisting( MScanListItem* network, QString addr ) { MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); while ( subitem && ( subitem->text( col_ap ) != addr ) ) { qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); - subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); + subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); } if ( subitem ) { // we have already seen this item, it's a dupe #ifdef DEBUG qDebug( "%s is a dupe - ignoring...", (const char*) addr ); #endif |