diff options
author | Florian Bruhin <git@the-compiler.org> | 2016-04-26 22:30:27 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2016-04-30 14:42:17 +0200 |
commit | 991277e9de567fd2f59306d197afdc05c01fd6c2 (patch) | |
tree | 55657855712424e36438d7ad18a44f709805b38a | |
parent | 133e959ecc0bfb19ded8fc386cee44752c4a294e (diff) | |
download | qutebrowser-991277e9de567fd2f59306d197afdc05c01fd6c2.tar.gz qutebrowser-991277e9de567fd2f59306d197afdc05c01fd6c2.zip |
Work around PyQt 5.6 segfault when using IPC
PyQt 5.6 seems to segfault when emitting None with a signal which is
declared as emitting a string:
https://www.riverbankcomputing.com/pipermail/pyqt/2016-April/037375.html
We now avoid this by using an empty string explicitly instead of None.
-rw-r--r-- | qutebrowser/app.py | 9 | ||||
-rw-r--r-- | qutebrowser/misc/ipc.py | 13 |
2 files changed, 14 insertions, 8 deletions
diff --git a/qutebrowser/app.py b/qutebrowser/app.py index b22d3b8eb..165b70fac 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -244,12 +244,7 @@ def process_pos_args(args, via_ipc=False, cwd=None, target_arg=None): cwd: The cwd to use for fuzzy_url. target_arg: Command line argument received by a running instance via ipc. If the --target argument was not specified, target_arg - will be an empty string instead of None. This behavior is - caused by the PyQt signal - ``got_args = pyqtSignal(list, str, str)`` - used in the misc.ipc.IPCServer class. PyQt converts the - None value into a null QString and then back to an empty - python string + will be an empty string. """ if via_ipc and not args: win_id = mainwindow.get_window(via_ipc, force_window=True) @@ -275,6 +270,8 @@ def process_pos_args(args, via_ipc=False, cwd=None, target_arg=None): tabbed_browser = objreg.get('tabbed-browser', scope='window', window=win_id) log.init.debug("Startup URL {}".format(cmd)) + if not cwd: # could also be an empty string due to the PyQt signal + cwd = None try: url = urlutils.fuzzy_url(cmd, cwd, relative=True) except urlutils.InvalidUrlError as e: diff --git a/qutebrowser/misc/ipc.py b/qutebrowser/misc/ipc.py index 28462d44b..aa219fab7 100644 --- a/qutebrowser/misc/ipc.py +++ b/qutebrowser/misc/ipc.py @@ -340,8 +340,17 @@ class IPCServer(QObject): self._handle_invalid_data() return - cwd = json_data.get('cwd', None) - self.got_args.emit(json_data['args'], json_data['target_arg'], cwd) + args = json_data['args'] + + target_arg = json_data['target_arg'] + if target_arg is None: + # https://www.riverbankcomputing.com/pipermail/pyqt/2016-April/037375.html + target_arg = '' + + cwd = json_data.get('cwd', '') + assert cwd is not None + + self.got_args.emit(args, target_arg, cwd) self._timer.start() @pyqtSlot() |