Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions qasync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,13 @@ def add_reader(self, fd, callback, *args):
else:
# this is necessary to avoid race condition-like issues
existing.setEnabled(False)
existing.activated.disconnect()
existing.activated['int'].disconnect()
# will get overwritten by the assignment below anyways

notifier = QtCore.QSocketNotifier(fd, QtCore.QSocketNotifier.Read)
notifier.setEnabled(True)
self._logger.debug('Adding reader callback for file descriptor {}'.format(fd))
notifier.activated.connect(
notifier.activated['int'].connect(
lambda: self.__on_notifier_ready(
self._read_notifiers, notifier, fd, callback, args) # noqa: C812
)
Expand Down Expand Up @@ -430,13 +430,13 @@ def add_writer(self, fd, callback, *args):
else:
# this is necessary to avoid race condition-like issues
existing.setEnabled(False)
existing.activated.disconnect()
existing.activated['int'].disconnect()
# will get overwritten by the assignment below anyways

notifier = QtCore.QSocketNotifier(fd, QtCore.QSocketNotifier.Write)
notifier.setEnabled(True)
self._logger.debug('Adding writer callback for file descriptor {}'.format(fd))
notifier.activated.connect(
notifier.activated['int'].connect(
lambda: self.__on_notifier_ready(
self._write_notifiers, notifier, fd, callback, args) # noqa: C812
)
Expand Down Expand Up @@ -470,7 +470,7 @@ def __notifier_cb_wrapper(self, notifiers, notifier, fd, callback, args):
if notifiers.get(fd, None) is notifier:
notifier.setEnabled(True)
else:
notifier.activated.disconnect()
notifier.activated['int'].disconnect()

def __on_notifier_ready(self, notifiers, notifier, fd, callback, args):
if fd not in notifiers:
Expand Down
6 changes: 3 additions & 3 deletions qasync/_unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ def register(self, fileobj, events, data=None):

if events & EVENT_READ:
notifier = QtCore.QSocketNotifier(key.fd, QtCore.QSocketNotifier.Read)
notifier.activated.connect(self.__on_read_activated)
notifier.activated['int'].connect(self.__on_read_activated)
self.__read_notifiers[key.fd] = notifier
if events & EVENT_WRITE:
notifier = QtCore.QSocketNotifier(key.fd, QtCore.QSocketNotifier.Write)
notifier.activated.connect(self.__on_write_activated)
notifier.activated['int'].connect(self.__on_write_activated)
self.__write_notifiers[key.fd] = notifier

return key
Expand All @@ -138,7 +138,7 @@ def drop_notifier(notifiers):
except KeyError:
pass
else:
notifier.activated.disconnect()
notifier.activated['int'].disconnect()

try:
key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))
Expand Down