Skip to content

Failed activate_window crashes the interpreter #24

@chaselambda

Description

@chaselambda

X errors don't get caught when calling activate_window, like they do for other commands as mentioned in #6.

Here's how to reproduce the issue:

$ python
Python 2.7.15+ (default, Oct  7 2019, 17:39:04)
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xdo
>>> x = xdo.Xdo()
>>> x.activate_window(123)
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 315, in 'calling callback function'
  File "/home/ubuntu/.local/lib/python2.7/site-packages/xdo/__init__.py", line 69, in _handle_x_error
    raise XError('Event: {}'.format(evt))
xdo.XError: Event: <xdo.xdo.LP_XErrorEvent object at 0x7f946f070dd0>
XGetWindowProperty failed!Segmentation fault (core dumped)
$

It may be the case that it's not possible to fix this issue without either:
a) Modifying xdotool itself
b) Forking a process and running xdo from there. That process can then crash without the main python process crashing.
c) Checking that the window is valid before sending some of these commands, but that could cause a race condition

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions