Skip to content

Commit 1210fc1

Browse files
committed
apply Sam's fix for buggy file handle re-use
1 parent 953caec commit 1210fc1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/watchdog/observers/read_directory_changes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ def start(self) -> None:
5858
sleep(0.01)
5959

6060
def on_thread_stop(self) -> None:
61-
if self._whandle:
62-
close_directory_handle(self._whandle)
61+
whandle = self._whandle
62+
if whandle:
63+
self._whandle = None
64+
close_directory_handle(whandle)
6365

6466
def _read_events(self) -> list[WinAPINativeEvent]:
6567
if not self._whandle:

0 commit comments

Comments
 (0)