Fix wxFileSystemWatcher::Remove() in wxMSW.

Removing the path watched by wxFileSystemWatcher didn't do anything in wxMSW
implementation so we still continued getting events for the changes to this
path even after calling Remove().

Fix this by really implementing Remove() properly. Also add a unit test
checking that we don't get any events after calling Remove().

See #12847.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-05-03 23:31:29 +00:00
parent 17e23c0cb9
commit 51fb867819
3 changed files with 102 additions and 3 deletions

View File

@@ -108,9 +108,9 @@ bool wxFSWatcherImplMSW::DoAdd(wxSharedPtr<wxFSWatchEntryMSW> watch)
}
bool
wxFSWatcherImplMSW::DoRemove(wxSharedPtr<wxFSWatchEntryMSW> WXUNUSED(watch))
wxFSWatcherImplMSW::DoRemove(wxSharedPtr<wxFSWatchEntryMSW> watch)
{
return true;
return m_iocp.ScheduleForRemoval(watch);
}
// TODO ensuring that we have not already set watch for this handle/dir?
@@ -216,6 +216,11 @@ bool wxIOCPThread::ReadEvents()
wxLogTrace( wxTRACE_FSWATCHER, "[iocp] Read entry: path='%s'",
watch->GetPath());
// First check if we're still interested in this watch, we could have
// removed it in the meanwhile.
if ( m_iocp->CompleteRemoval(watch) )
return true;
// extract events from buffer info our vector container
wxVector<wxEventProcessingData> events;
const char* memory = static_cast<const char*>(watch->GetBuffer());