Attempt to fix a race condition and subsequent crash

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1144369 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 8a34a88474
commit 23a3d3aa5b

@ -195,23 +195,43 @@ DirFilterPlugin::DirFilterPlugin (QObject* parent, const char* name,
{
QWhatsThis::add(m_searchWidget, i18n("Enter here a text which an item in the view must contain anywhere to be shown."));
connect(clear, SIGNAL(activated()), m_searchWidget, SLOT(clear()));
connect(m_searchWidget, SIGNAL(textChanged(const QString&)), this, SLOT(searchTextChanged(const QString&)));
}
KWidgetAction *filterAction = new KWidgetAction(hbox, i18n("Filter Field"),
0, 0, 0, actionCollection(), "toolbar_filter_field");
filterAction->setShortcutConfigurable(false);
// FIXME: This causes crashes for an unknown reason on certain systems
// Probably the iconview onchange event handler should tempoarily stop this timer before doing anything else
// Really the broken Qt3 iconview should just be modified to include a hidden list; it would make things *so* much easier!
m_refreshTimer = new QTimer( this );
m_reactivateRefreshTimer = new QTimer( this );
connect( m_refreshTimer, SIGNAL(timeout()), this, SLOT(activateSearch()) );
m_refreshTimer->start( 200, FALSE ); // 200 millisecond continuous timer
connect( m_reactivateRefreshTimer, SIGNAL(timeout()), this, SLOT(reactivateRefreshTimer()) );
}
DirFilterPlugin::~DirFilterPlugin()
{
m_reactivateRefreshTimer->stop();
m_refreshTimer->stop();
delete m_pFilterMenu;
delete m_refreshTimer;
delete m_reactivateRefreshTimer;
}
void DirFilterPlugin::searchTextChanged(const QString& newtext)
{
m_refreshTimer->stop();
m_reactivateRefreshTimer->stop();
m_reactivateRefreshTimer->start( 1000, TRUE );
}
void DirFilterPlugin::reactivateRefreshTimer()
{
m_refreshTimer->start( 200, FALSE ); // 200 millisecond continuous time
}
void DirFilterPlugin::slotOpenURL ()
@ -474,6 +494,10 @@ void DirFilterPlugin::slotItemRemoved (const KFileItem* item)
void DirFilterPlugin::activateSearch()
{
// FIXME: If any of the files change while they are hidden in iconview mode, they will
// reappear under the wrong (old) name. This routine was originally intended to fix that
// problem, but will need to be able to detect when a change has occurred to be effective.
if (!m_searchWidget)
return;

@ -121,11 +121,14 @@ private slots:
void slotItemRemoved(const KFileItem *);
void slotItemsAdded(const KFileItemList &);
void activateSearch();
void searchTextChanged(const QString& newtext);
void reactivateRefreshTimer();
private:
KURL m_pURL;
KonqDirPart* m_part;
QTimer *m_refreshTimer;
QTimer *m_reactivateRefreshTimer;
KActionMenu* m_pFilterMenu;
QString m_oldFilterString;

Loading…
Cancel
Save