segmentation fault with addControl()
#1
I'm testing a simple, very simple, script with Eden beta3-live. It is enough to enter/exit script few times to generate the segfault. The script is al follows:
Code:
import sys
import xbmcgui

ACTION_PREVIOUS_MENU = 10

class Pattern(xbmcgui.Window):
    def __init__(self):
        self.addControl(xbmcgui.ControlLabel(100, 300, 200, 100, "XXXXXXXXXXXXXXXXX"))

    def onAction(self, action):
        if action == ACTION_PREVIOUS_MENU:
            self.close()

if (__name__ == "__main__"):
    win = Pattern()
    win.doModal()
    del win

Ths produces following crash log:
Code:
[Thread debugging using libthread_db enabled]
Core was generated by `/usr/lib/xbmc/xbmc.bin --standalone'.
Program terminated with signal 11, Segmentation fault.
#0  0x08465428 in CGUIControl::~CGUIControl() ()
[...]
Thread 1 (Thread 0x5c7f40 (LWP 28306)):
#0  0x08465428 in CGUIControl::~CGUIControl() ()
#1  0x0849fa23 in CGUILabelControl::~CGUILabelControl() ()
#2  0x0849fb32 in CGUILabelControl::~CGUILabelControl() ()
#3  0x08474366 in CGUIControlGroup::ClearAll() ()
#4  0x084eb50d in CGUIWindow::ClearAll() ()
#5  0x084eb5c4 in CGUIWindow::FreeResources(bool) ()
#6  0x084f2baa in CGUIWindowManager::FrameMove() ()
#7  0x08a91f3e in CApplication::FrameMove(bool) ()
#8  0x08b1e048 in CXBApplicationEx::Run() ()
#9  0x08237c0a in main ()

Without the addControl() it works fine. Replacing ControlLabel with ImageLabel produces the crash again. Are there any problems around CGUI*() destructors? Or am I missing something in the script?
Reply
#2
I think you need to remove the control before you deinit the window. There's a comment in the source prefixed by BUG: (see window.cpp in interfaces/python/xbmcmodule) that suggests this.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
I did it already, now the still simple script looks like:
Code:
import xbmcgui

ACTION_PREVIOUS_MENU = 10

class Pattern(xbmcgui.Window):
    def __init__(self):
        self.C=xbmcgui.ControlLabel(100, 300, 200, 100, "XXXXXXXXXXXXXXXXX")
        self.addControl(self.C)

    def onAction(self, action):
        if action == ACTION_PREVIOUS_MENU:
            self.removeControl(self.C)
            del self.C
            self.close()

if (__name__ == "__main__"):
    win = Pattern()
    win.doModal()
    del win

What solved the initial problem, but now it crashes with libsqlite3:
Code:
[Thread debugging using libthread_db enabled]
Core was generated by `/usr/lib/xbmc/xbmc.bin --standalone'.
Program terminated with signal 11, Segmentation fault.
#0  0x00673d2f in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
[...]
Thread 2 (Thread 0x800710 (LWP 24881)):
#0  0xb6e9bd18 in ?? () from /usr/lib/nvidia-current/libnvidia-glcore.so.280.13
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 1 (Thread 0xb22ffb70 (LWP 24941)):
#0  0x00673d2f in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#1  0x0066df95 in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#2  0x006719c4 in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#3  0x00675c0c in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#4  0x00675e41 in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#5  0x0067640d in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#6  0x0066494c in sqlite3_exec () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#7  0x00664f2e in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#8  0x00665129 in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#9  0x00665492 in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#10 0x006659eb in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#11 0x00665bcb in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#12 0x006176d6 in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#13 0x006183ad in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#14 0x00642ae7 in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#15 0x0066e7dd in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#16 0x006719c4 in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#17 0x00675c0c in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#18 0x00675e41 in ?? () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#19 0x00664739 in sqlite3_exec () from /usr/lib/i386-linux-gnu/libsqlite3.so.0
#20 0x086f36db in dbiplus::SqliteDatabase::exists() ()
#21 0x086e074b in CDatabase::Connect(DatabaseSettings const&, bool) ()
#22 0x086e21fc in CDatabase::Open(DatabaseSettings const&) ()
#23 0x086e2ee3 in CDatabase::Open() ()
#24 0x08b0010b in CTextureDatabase::Open() ()
#25 0x08b047a6 in CThumbLoader::GetCachedThumb(CFileItem const&) ()
#26 0x08b05474 in CProgramThumbLoader::FillThumb(CFileItem&) ()
#27 0x08b057a3 in CProgramThumbLoader::LoadItem(CFileItem*) ()
#28 0x08a9e362 in CBackgroundInfoLoader::Run() ()
#29 0x08a42278 in CThread::Process() ()
#30 0x08a42e02 in CThread::staticThread(void*) ()
#31 0x002eb9cd in ?? () from /usr/lib/nvidia-current/libGL.so.1
#32 0x0903e0ce in clone () from /lib/i386-linux-gnu/libc.so.6
Reply
#4
My guess is someone has stomped memory.

Essentially: Adding controls to existing windows is dangerous - don't do it unless you're prepared to fix the bugs first.

The preferred method is for python to supply it's own windows via winxml (i.e. so python doesn't go creating extras at all).

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
I did not want to study the code and I got all info I needed. Thanks for the explanation.
Reply

Logout Mark Read Team Forum Stats Members Help
segmentation fault with addControl()0