escrotum
escrotum copied to clipboard
Crashes when taking a screenshot, then can't close
Installed today on Ubuntu 18.04 via pip running i13wm 4.17.1.
~ ❯ escrotum -s ~/scrot.png
Gtk-Message: 10:29:09.016: GtkDialog mapped without a transient parent. This is discouraged.
No numpy support, saving would be slower
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 278, in capture
self.capture_image(x, y, width, height, window)
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 294, in capture_image
pb2 = self.mask_pixbuf(pb2, root_width, root_height)
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 368, in mask_pixbuf
data = bgra2rgba(pixels, width, height)
File "/usr/local/lib/python3.6/dist-packages/escrotum/util.py", line 111, in bgra2rgba
data = array.array ("c", pixels)
ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)
^CTraceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 184, in event_handler
def event_handler(self, event):
KeyboardInterrupt
^C^C^C^C^C^C^CTraceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 184, in event_handler
def event_handler(self, event):
KeyboardInterrupt
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^CTraceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 184, in event_handler
def event_handler(self, event):
KeyboardInterrupt
Had to sigkill the process.
After installing numpy I get
~ ❯ escrotum -s ~/scrot.png
Gtk-Message: 10:39:26.216: GtkDialog mapped without a transient parent. This is discouraged.
[1] 28470 segmentation fault (core dumped) escrotum -s ~/scrot.png
Getting the same problem, also installed via pip on Ubuntu 18.04 and i3wm.
File "/usr/local/lib/python3.6/dist-packages/escrotum/util.py", line 111, in bgra2rgba data = array.array ("c", pixels) ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)
This is already fixed in #57.
For the second issue a stack trace would be helpful to see where the segfault happens.
Happy to provide one, let me know what to run to get it.
Something like gdb python and then run <escrotum module/script> and bt after it segfaulted.
Is this what you were looking for?
Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
0x00007ffff3755020 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0
(gdb) bt
#0 0x00007ffff3755020 in () at /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0
#1 0x00007ffff374c169 in gdk_pixbuf_scale ()
at /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0
#2 0x00007ffff5c18dae in ffi_call_unix64 () at /usr/lib/x86_64-linux-gnu/libffi.so.6
#3 0x00007ffff5c1871f in ffi_call () at /usr/lib/x86_64-linux-gnu/libffi.so.6
#4 0x00007ffff65e5e6a in ()
at /usr/lib/python3/dist-packages/gi/_gi.cpython-36m-x86_64-linux-gnu.so
#5 0x00007ffff65e7a48 in ()
at /usr/lib/python3/dist-packages/gi/_gi.cpython-36m-x86_64-linux-gnu.so
#6 0x00007ffff65dbcb9 in ()
at /usr/lib/python3/dist-packages/gi/_gi.cpython-36m-x86_64-linux-gnu.so
#7 0x00000000005a9cbc in _PyObject_FastCallKeywords ()
#8 0x000000000050a5c3 in ()
#9 0x000000000050bfb4 in _PyEval_EvalFrameDefault ()
#10 0x0000000000509758 in ()
#11 0x000000000050a48d in ()
#12 0x000000000050bfb4 in _PyEval_EvalFrameDefault ()
#13 0x0000000000509758 in ()
#14 0x000000000050a48d in ()
#15 0x000000000050bfb4 in _PyEval_EvalFrameDefault ()
#16 0x0000000000509758 in ()
#17 0x000000000050a48d in ()
#18 0x000000000050bfb4 in _PyEval_EvalFrameDefault ()
#19 0x0000000000507d64 in ()
#20 0x0000000000509042 in _PyFunction_FastCallDict ()
#21 0x0000000000594931 in ()
#22 0x0000000000549e5f in ()
#23 0x00000000005513d1 in ()
#24 0x00000000005a9cbc in _PyObject_FastCallKeywords ()
#25 0x000000000050a5c3 in ()
#26 0x000000000050cd96 in _PyEval_EvalFrameDefault ()
#27 0x0000000000509758 in ()
#28 0x000000000050a48d in ()
#29 0x000000000050bfb4 in _PyEval_EvalFrameDefault ()
#30 0x0000000000507d64 in ()
#31 0x000000000050ae13 in PyEval_EvalCode ()
#32 0x0000000000634c82 in ()
#33 0x0000000000634d37 in PyRun_FileExFlags ()
#34 0x00000000006384ef in PyRun_SimpleFileExFlags ()
#35 0x0000000000639091 in Py_Main ()
#36 0x00000000004b0d00 in main ()
@gigosaurus Thanks, that helps. I think this is an issue with the old version of PyGObject. More precisely Pixbuf.new_from_data() has memory management issues and was fixed with version 3.29.3, but Ubuntu 18.04 uses 3.26.1.
You could try applying this patch and see if it works:
--- a/escrotum/main.py
+++ b/escrotum/main.py
@@ -364,9 +364,9 @@ class Escrotum(gtk.Dialog):
stride = img.get_stride()
pixels = img.get_data()
- data = bgra2rgba(pixels, width, height)
+ data = glib.Bytes.new(bgra2rgba(pixels, width, height))
- new_pb = Pixbuf.Pixbuf.new_from_data(data, Pixbuf.Colorspace.RGB,
+ new_pb = Pixbuf.Pixbuf.new_from_bytes(data, Pixbuf.Colorspace.RGB,
True, 8, width, height, stride)
return new_pb
I don't know if the function is available with your versions and I don't know all implications of using GLib.Bytes, but it might fix your issue.