pylibui
pylibui copied to clipboard
Segmentation faults
I have problems about running tests and examples. Some of them ends with a segmentation fault. I think there are some problems about getters of components like window and checkbox. And I think it's about boolean difference between Python and C.
I'm using Ubuntu 16.04 Am I the only person that have problems about tests or anyone can confirm that there is a problem?
I haven't test it lately, but I've never had any problem running on OSX Mavericks (10.9.5). But I've checked on the libui project, and I think there's some problems on Linux, for instance (https://github.com/andlabs/libui/issues/214) and (https://github.com/andlabs/libui/issues/207).
Yes, I encountered a couple of segfaults on quitting (on macOS 10.11/10.12). That happens to me on two occasions:
- When a widget has been instanced, but is not "appended" to any box/window. Little example that seg faults for me :
from pylibui.core import App
from pylibui.controls import Button, Window
class MyWindow(Window):
def onClose(self, data):
super().onClose(data)
app.stop()
app = App()
window = MyWindow('mywindow')
button = Button('mybutton')
# window.setChild(button)
window.show()
app.start()
app.close()
If I uncomment the line window.setChild(button)
, no crashes.
- On SearchEntry + PasswordEntry (eg
tests/entry.py
). Example:
from pylibui.core import App
from pylibui.controls import Window, Entry, SearchEntry, PasswordEntry
class MyWindow(Window):
def onClose(self, data):
super().onClose(data)
app.stop()
app = App()
window = MyWindow('mywindow')
entry = PasswordEntry()
window.setChild(entry)
window.show()
app.start()
app.close()
If I replace entry = PasswordEntry()
by entry = Entry()
, no crashes.
We may have done something wrong while implementing something... I'll do some tests later.
EDIT: here's the error I got everytime:
2016-10-19 18:29:06.529 Python[29532:4616674] [libui] /Users/nikkos/Documents/libui/darwin/map.m:25:mapDestroy() POSSIBLE IMPLEMENTATION BUG; CONTACT ANDLABS:
attempt to destroy map with items inside
zsh: illegal hardware instruction python3 test.py
Set a breakpoint on libui's _implbug()
and get a stack trace when that message pops ups so we can figure out which internal-to-libui data structure is causing it.
Can someone help with this issue? For those who do not know, @andlabs is the author of the C libui, so he can check things on the C lib if needed..
Okay, got it.
I focused on the first code example (the one with the button with no parent); as I wasn't really sure about my implementation of Entries.
I rewrote the same code in C, so that I could know which code base introduced the bug. The bug did not appear in C.
That's where I realised that C examples in libui repo did not call uiUninit()
(well, except for the "histogram" one, but that's not the latest updated).
When I removed app.close()
from my Python code, everything worked without crashing. That also resolved the crash I was having with the Entries.
(sorry, failed to use gdb on mac with python3...)
Okay, then it is what I was thinking of. I'll fix it eventually (it's a chicken and egg problem :/ or at least I think; I thought I fixed this 5 different ways already and don't remember what happened each time).