author | mickeyl <mickeyl> | 2003-05-02 22:56:35 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-02 22:56:35 (UTC) |
commit | 5ca7f12dab929b21c133f785a3328c949df69401 (patch) (unidiff) | |
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 | |||
@@ -106,60 +106,42 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
106 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", | 106 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", |
107 | (const char*) type, | 107 | (const char*) type, |
108 | (const char*) essid, | 108 | (const char*) essid, |
109 | (const char*) macaddr, | 109 | (const char*) macaddr, |
110 | channel ); | 110 | channel ); |
111 | 111 | ||
112 | // search, if we already have seen this net | 112 | // search, if we already have seen this net |
113 | 113 | ||
114 | QString s; | 114 | QString s; |
115 | MScanListItem* network; | 115 | MScanListItem* network; |
116 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 116 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
117 | 117 | ||
118 | while ( item && ( item->text( 0 ) != essid ) ) | 118 | while ( item && ( item->text( col_essid ) != essid ) ) |
119 | { | 119 | { |
120 | qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); | 120 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); |
121 | item = static_cast<MScanListItem*> ( item->itemBelow() ); | 121 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
122 | } | 122 | } |
123 | if ( item ) | 123 | if ( item ) |
124 | { | 124 | { |
125 | // animate the item | ||
126 | |||
127 | /* | ||
128 | |||
129 | const QPixmap* pixmap = item->pixmap( 0 ); | ||
130 | const QPixmap* nextpixmap = ani2; | ||
131 | if ( pixmap == ani1 ) | ||
132 | nextpixmap = ani2; | ||
133 | else if ( pixmap == ani2 ) | ||
134 | nextpixmap = ani3; | ||
135 | else if ( pixmap == ani3 ) | ||
136 | nextpixmap = ani4; | ||
137 | else if ( pixmap == ani4 ) | ||
138 | nextpixmap = ani1; | ||
139 | item->setPixmap( 0, *nextpixmap ); */ | ||
140 | |||
141 | //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap ); | ||
142 | |||
143 | // we have already seen this net, check all childs if MAC exists | 125 | // we have already seen this net, check all childs if MAC exists |
144 | 126 | ||
145 | network = item; | 127 | network = item; |
146 | 128 | ||
147 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 129 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
148 | assert( item ); // this shouldn't fail | 130 | assert( item ); // this shouldn't fail |
149 | 131 | ||
150 | while ( item && ( item->text( 2 ) != macaddr ) ) | 132 | while ( item && ( item->text( col_ap ) != macaddr ) ) |
151 | { | 133 | { |
152 | qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); | 134 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); |
153 | item = static_cast<MScanListItem*> ( item->itemBelow() ); | 135 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
154 | } | 136 | } |
155 | 137 | ||
156 | if ( item ) | 138 | if ( item ) |
157 | { | 139 | { |
158 | // we have already seen this item, it's a dupe | 140 | // we have already seen this item, it's a dupe |
159 | #ifdef DEBUG | 141 | #ifdef DEBUG |
160 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 142 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
161 | #endif | 143 | #endif |
162 | item->receivedBeacon(); | 144 | item->receivedBeacon(); |
163 | return; | 145 | return; |
164 | } | 146 | } |
165 | } | 147 | } |
@@ -190,25 +172,25 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
190 | } | 172 | } |
191 | 173 | ||
192 | } | 174 | } |
193 | 175 | ||
194 | 176 | ||
195 | void MScanListView::addIfNotExisting( MScanListItem* network, QString addr ) | 177 | void MScanListView::addIfNotExisting( MScanListItem* network, QString addr ) |
196 | { | 178 | { |
197 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 179 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
198 | 180 | ||
199 | while ( subitem && ( subitem->text( col_ap ) != addr ) ) | 181 | while ( subitem && ( subitem->text( col_ap ) != addr ) ) |
200 | { | 182 | { |
201 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | 183 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); |
202 | subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); | 184 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
203 | } | 185 | } |
204 | 186 | ||
205 | if ( subitem ) | 187 | if ( subitem ) |
206 | { | 188 | { |
207 | // we have already seen this item, it's a dupe | 189 | // we have already seen this item, it's a dupe |
208 | #ifdef DEBUG | 190 | #ifdef DEBUG |
209 | qDebug( "%s is a dupe - ignoring...", (const char*) addr ); | 191 | qDebug( "%s is a dupe - ignoring...", (const char*) addr ); |
210 | #endif | 192 | #endif |
211 | subitem->receivedBeacon(); //FIXME: sent data bit | 193 | subitem->receivedBeacon(); //FIXME: sent data bit |
212 | return; | 194 | return; |
213 | } | 195 | } |
214 | 196 | ||