Fixed random filter bar crashes (some of bug 180, not all of it yet unfortunately...)

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1122569 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 15 years ago
parent 333cd24e78
commit c1b28a61b6

@ -461,7 +461,7 @@ void KConfigINIBackEnd::parseSingleConfigFile(QFile &rFile,
QCString aCurrentGroup("<default>"); QCString aCurrentGroup("<default>");
unsigned int ll = localeString.length(); static unsigned int ll = localeString.length();
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
static volatile const char *map; static volatile const char *map;

@ -41,6 +41,7 @@ public:
iconView( 0 ), iconView( 0 ),
caseSensitive( DEFAULT_CASESENSITIVE ), caseSensitive( DEFAULT_CASESENSITIVE ),
activeSearch( false ), activeSearch( false ),
hiddenItemsLockout( false ),
queuedSearches( 0 ) {} queuedSearches( 0 ) {}
QIconView *iconView; QIconView *iconView;
@ -48,6 +49,7 @@ public:
bool activeSearch; bool activeSearch;
QString search; QString search;
int queuedSearches; int queuedSearches;
bool hiddenItemsLockout;
QIconViewItemList hiddenItems; QIconViewItemList hiddenItems;
}; };
@ -97,8 +99,6 @@ void KIconViewSearchLine::updateSearch( const QString &s )
QString search = d->search = s.isNull() ? text() : s; QString search = d->search = s.isNull() ? text() : s;
QIconViewItemList *hi = &(d->hiddenItems);
QIconViewItem *currentItem = iv->currentItem(); QIconViewItem *currentItem = iv->currentItem();
QIconViewItem *item = NULL; QIconViewItem *item = NULL;
@ -119,14 +119,16 @@ void KIconViewSearchLine::updateSearch( const QString &s )
} }
// Add Matching items, remove from hidden list // Add Matching items, remove from hidden list
QIconViewItemList::iterator it = hi->begin(); d->hiddenItemsLockout = true;
while ( it != hi->end() ) QIconViewItemList::iterator it = d->hiddenItems.begin();
while ( it != d->hiddenItems.end() )
{ {
item = *it; item = *it;
++it; ++it;
if ( itemMatches( item, search ) ) if ( itemMatches( item, search ) )
showItem( item ); showItem( item );
} }
d->hiddenItemsLockout = false;
iv->sort(); iv->sort();
@ -138,6 +140,7 @@ void KIconViewSearchLine::clear()
{ {
// Clear hidden list, give items back to QIconView, if it still exists // Clear hidden list, give items back to QIconView, if it still exists
QIconViewItem *item = NULL; QIconViewItem *item = NULL;
d->hiddenItemsLockout = true;
QIconViewItemList::iterator it = d->hiddenItems.begin(); QIconViewItemList::iterator it = d->hiddenItems.begin();
while ( it != d->hiddenItems.end() ) while ( it != d->hiddenItems.end() )
{ {
@ -156,6 +159,8 @@ void KIconViewSearchLine::clear()
"hiddenItems is not empty as it should be. " << "hiddenItems is not empty as it should be. " <<
d->hiddenItems.count() << " items are still there.\n" << endl; d->hiddenItems.count() << " items are still there.\n" << endl;
d->hiddenItemsLockout= false;
d->search = ""; d->search = "";
d->queuedSearches = 0; d->queuedSearches = 0;
KLineEdit::clear(); KLineEdit::clear();
@ -196,7 +201,8 @@ bool KIconViewSearchLine::itemMatches( const QIconViewItem *item,
if ( item == NULL ) if ( item == NULL )
return false; return false;
return ( item->text().find( s, 0, caseSensitive() ) >= 0 ); QString itemtext = item->text();
return ( itemtext.find( s, 0, caseSensitive() ) >= 0 );
} }
void KIconViewSearchLine::init( QIconView *iconView ) void KIconViewSearchLine::init( QIconView *iconView )
@ -238,7 +244,9 @@ void KIconViewSearchLine::showItem( QIconViewItem *item )
return; return;
} }
d->iconView->insertItem( item ); d->iconView->insertItem( item );
d->hiddenItems.remove( item ); if (d->hiddenItemsLockout == false) {
d->hiddenItems.remove( item );
}
} }
/****************************************************************************** /******************************************************************************

@ -191,6 +191,8 @@ void KFileItem::readUDSEntry( bool _urlIsDirectory )
// extract the mode and the filename from the KIO::UDS Entry // extract the mode and the filename from the KIO::UDS Entry
bool UDS_URL_seen = false; bool UDS_URL_seen = false;
if (&m_entry == NULL) return;
KIO::UDSEntry::ConstIterator it = m_entry.begin(); KIO::UDSEntry::ConstIterator it = m_entry.begin();
for( ; it != m_entry.end(); ++it ) { for( ; it != m_entry.end(); ++it ) {
switch ((*it).m_uds) { switch ((*it).m_uds) {
@ -295,6 +297,8 @@ void KFileItem::setName( const QString& name )
QString KFileItem::linkDest() const QString KFileItem::linkDest() const
{ {
if (&m_entry == NULL) return QString::null;
// Extract it from the KIO::UDSEntry // Extract it from the KIO::UDSEntry
KIO::UDSEntry::ConstIterator it = m_entry.begin(); KIO::UDSEntry::ConstIterator it = m_entry.begin();
for( ; it != m_entry.end(); ++it ) for( ; it != m_entry.end(); ++it )
@ -322,6 +326,8 @@ QString KFileItem::localPath() const
} }
else else
{ {
if (&m_entry == NULL) return QString::null;
// Extract the local path from the KIO::UDSEntry // Extract the local path from the KIO::UDSEntry
KIO::UDSEntry::ConstIterator it = m_entry.begin(); KIO::UDSEntry::ConstIterator it = m_entry.begin();
const KIO::UDSEntry::ConstIterator end = m_entry.end(); const KIO::UDSEntry::ConstIterator end = m_entry.end();
@ -339,6 +345,8 @@ KIO::filesize_t KFileItem::size(bool &exists) const
if ( m_size != (KIO::filesize_t) -1 ) if ( m_size != (KIO::filesize_t) -1 )
return m_size; return m_size;
if (&m_entry == NULL) return 0L;
// Extract it from the KIO::UDSEntry // Extract it from the KIO::UDSEntry
KIO::UDSEntry::ConstIterator it = m_entry.begin(); KIO::UDSEntry::ConstIterator it = m_entry.begin();
for( ; it != m_entry.end(); ++it ) for( ; it != m_entry.end(); ++it )
@ -359,6 +367,7 @@ KIO::filesize_t KFileItem::size(bool &exists) const
bool KFileItem::hasExtendedACL() const bool KFileItem::hasExtendedACL() const
{ {
if (&m_entry == NULL) return false;
KIO::UDSEntry::ConstIterator it = m_entry.begin(); KIO::UDSEntry::ConstIterator it = m_entry.begin();
for( ; it != m_entry.end(); it++ ) for( ; it != m_entry.end(); it++ )
if ( (*it).m_uds == KIO::UDS_EXTENDED_ACL ) { if ( (*it).m_uds == KIO::UDS_EXTENDED_ACL ) {
@ -370,6 +379,8 @@ bool KFileItem::hasExtendedACL() const
KACL KFileItem::ACL() const KACL KFileItem::ACL() const
{ {
if ( hasExtendedACL() ) { if ( hasExtendedACL() ) {
if (&m_entry == NULL) return KACL( m_permissions );
// Extract it from the KIO::UDSEntry // Extract it from the KIO::UDSEntry
KIO::UDSEntry::ConstIterator it = m_entry.begin(); KIO::UDSEntry::ConstIterator it = m_entry.begin();
for( ; it != m_entry.end(); ++it ) for( ; it != m_entry.end(); ++it )
@ -382,6 +393,8 @@ KACL KFileItem::ACL() const
KACL KFileItem::defaultACL() const KACL KFileItem::defaultACL() const
{ {
if (&m_entry == NULL) return KACL();
// Extract it from the KIO::UDSEntry // Extract it from the KIO::UDSEntry
KIO::UDSEntry::ConstIterator it = m_entry.begin(); KIO::UDSEntry::ConstIterator it = m_entry.begin();
for( ; it != m_entry.end(); ++it ) for( ; it != m_entry.end(); ++it )
@ -421,6 +434,8 @@ time_t KFileItem::time( unsigned int which, bool &hasTime ) const
if ( m_time[mappedWhich] != (time_t) -1 ) if ( m_time[mappedWhich] != (time_t) -1 )
return m_time[mappedWhich]; return m_time[mappedWhich];
if (&m_entry == NULL) return static_cast<time_t>(0);
// Extract it from the KIO::UDSEntry // Extract it from the KIO::UDSEntry
KIO::UDSEntry::ConstIterator it = m_entry.begin(); KIO::UDSEntry::ConstIterator it = m_entry.begin();
for( ; it != m_entry.end(); ++it ) for( ; it != m_entry.end(); ++it )

Loading…
Cancel
Save