Skip to content

Commit

Permalink
Fix r6936.
Browse files Browse the repository at this point in the history
Former-commit-id: 67deb9ae855da9952d11c617da2743fc5acd82f8
  • Loading branch information
ylangisc committed Dec 11, 2012
1 parent acb8587 commit 261eb6b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion source/ch/cyberduck/ui/controller/BrowserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class BrowserController : WindowController<IBrowserView>, TranscriptListe
private readonly BookmarkModel _bookmarkModel;
private readonly TreeBrowserModel _browserModel;
private readonly List<Path> _forwardHistory = new List<Path>();
private readonly IList<FileSystemWatcher> _temporaryWatcher = new List<FileSystemWatcher>();
private Comparator _comparator = new NullComparator();
private InfoController _inspector;
private BrowserView _lastBookmarkView = BrowserView.Bookmark;
Expand Down Expand Up @@ -773,6 +774,7 @@ private void View_HostCanDrop(OlvDropEventArgs args)
private void View_HostEndDrag(DataObject data)
{
RemoveTemporaryFiles(data);
RemoveTemporaryFilesystemWatcher();
}

private string CreateAndWatchTemporaryFile(FileSystemEventHandler del)
Expand All @@ -796,7 +798,7 @@ private string CreateAndWatchTemporaryFile(FileSystemEventHandler del)
watcher.IncludeSubdirectories = true;
watcher.EnableRaisingEvents = true;
watcher.Created += del;
watcher.Created += delegate { watcher.Dispose(); };
_temporaryWatcher.Add(watcher);
}
catch (Exception e)
{
Expand Down Expand Up @@ -1873,6 +1875,15 @@ private DataObject View_BrowserDrag(ObjectListView listView)
return data;
}

private void RemoveTemporaryFilesystemWatcher()
{
foreach (FileSystemWatcher watcher in _temporaryWatcher)
{
watcher.Dispose();
}
_temporaryWatcher.Clear();
}

private void RemoveTemporaryFiles(DataObject data)
{
if (data.ContainsFileDropList())
Expand All @@ -1898,6 +1909,7 @@ private void RemoveTemporaryFiles(DataObject data)
private void View_BrowserEndDrag(DataObject data)
{
RemoveTemporaryFiles(data);
RemoveTemporaryFilesystemWatcher();
}

private void View_BrowserDropped(OlvDropEventArgs e)
Expand Down

0 comments on commit 261eb6b

Please sign in to comment.