Skip to content

Commit f86c8c6

Browse files
Merge pull request CabbageDevelopment#12 from lukas-hetzenecker/qt-5.15
Fix issues with Qt 5.15 where QSocketNotifier.activated became overloaded
2 parents 103b9a6 + 8844dd1 commit f86c8c6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

qasync/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,13 +394,13 @@ def add_reader(self, fd, callback, *args):
394394
else:
395395
# this is necessary to avoid race condition-like issues
396396
existing.setEnabled(False)
397-
existing.activated.disconnect()
397+
existing.activated['int'].disconnect()
398398
# will get overwritten by the assignment below anyways
399399

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

436436
notifier = QtCore.QSocketNotifier(fd, QtCore.QSocketNotifier.Write)
437437
notifier.setEnabled(True)
438438
self._logger.debug('Adding writer callback for file descriptor {}'.format(fd))
439-
notifier.activated.connect(
439+
notifier.activated['int'].connect(
440440
lambda: self.__on_notifier_ready(
441441
self._write_notifiers, notifier, fd, callback, args) # noqa: C812
442442
)
@@ -470,7 +470,7 @@ def __notifier_cb_wrapper(self, notifiers, notifier, fd, callback, args):
470470
if notifiers.get(fd, None) is notifier:
471471
notifier.setEnabled(True)
472472
else:
473-
notifier.activated.disconnect()
473+
notifier.activated['int'].disconnect()
474474

475475
def __on_notifier_ready(self, notifiers, notifier, fd, callback, args):
476476
if fd not in notifiers:

qasync/_unix.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ def register(self, fileobj, events, data=None):
110110

111111
if events & EVENT_READ:
112112
notifier = QtCore.QSocketNotifier(key.fd, QtCore.QSocketNotifier.Read)
113-
notifier.activated.connect(self.__on_read_activated)
113+
notifier.activated['int'].connect(self.__on_read_activated)
114114
self.__read_notifiers[key.fd] = notifier
115115
if events & EVENT_WRITE:
116116
notifier = QtCore.QSocketNotifier(key.fd, QtCore.QSocketNotifier.Write)
117-
notifier.activated.connect(self.__on_write_activated)
117+
notifier.activated['int'].connect(self.__on_write_activated)
118118
self.__write_notifiers[key.fd] = notifier
119119

120120
return key
@@ -138,7 +138,7 @@ def drop_notifier(notifiers):
138138
except KeyError:
139139
pass
140140
else:
141-
notifier.activated.disconnect()
141+
notifier.activated['int'].disconnect()
142142

143143
try:
144144
key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))

0 commit comments

Comments
 (0)