From: Felix Domke Date: Sat, 29 Jan 2005 00:19:00 +0000 (+0000) Subject: fixed refcount of eListboxPythonStringContent X-Git-Tag: 2.6.0~5933 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/cd621fe499141885e5a0d8b4e42a0f8a7f41a9ac?hp=31688e1b8f028059a700a92a8276c97928abd260 fixed refcount of eListboxPythonStringContent --- diff --git a/components.py b/components.py index 20827180..52c94606 100644 --- a/components.py +++ b/components.py @@ -229,17 +229,18 @@ class MenuList(HTMLComponent, GUIComponent): GUIComponent.__init__(self) def getCurrent(self): - return self.l.getCurrentSelection() +# return self.l.getCurrentSelection() + return "none" def GUIcreateInstance(self, priv, parent, skindata): g = eListbox(parent) # BIG BIG HACK. :( we have to ensure that the eListboxPythonStringContent doesn't get destroyed. # we really have to take a look at the GC stuff - self.l = eListboxPythonStringContent() - self.l.setList(["Test Object 1", "Item #2", "Item #3", "nun kommt eine Zahl:", 15, "Bla fasel", "lulabla"]) - g.setContent(self.l) + l = eListboxPythonStringContent() + l.setList(["Test Object 1", "Item #2", "Item #3", "nun kommt eine Zahl:", 15, "Bla fasel", "lulabla"]) + g.setContent(l) return g def GUIdeleteInstance(self, g): g.setContent(None) - del self.l + #del self.l diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index 96214aea..e06ab3e6 100644 --- a/lib/gui/elistbox.cpp +++ b/lib/gui/elistbox.cpp @@ -114,9 +114,7 @@ int eListbox::event(int event, void *data, void *data2) void eListbox::recalcSize() { - eDebug("recalc size"); m_itemheight = 20; m_content->setSize(eSize(size().width(), m_itemheight)); m_items_per_page = size().height() / m_itemheight; - eDebug("done!"); } diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index b84dbd14..ae15d0d9 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -33,6 +33,11 @@ is usually caused by not marking PSignals as immutable. */ +%define RefCount(...) +%typemap(newfree) __VA_ARGS__ * { eDebug("adding ref"); $1->AddRef(); } +%extend __VA_ARGS__ { ~__VA_ARGS__() { eDebug("removing ref!"); self->Release(); } } +%ignore __VA_ARGS__::~__VA_ARGS__(); +%enddef %module enigma %{ @@ -59,6 +64,8 @@ extern void runMainloop(); extern PSignal1 &keyPressedSignal(); %} +RefCount(eListboxPythonStringContent) + #define DEBUG %include "stl.i" %include diff --git a/mytest.py b/mytest.py index 5233d85e..e4a722ac 100644 --- a/mytest.py +++ b/mytest.py @@ -37,11 +37,11 @@ screens["global"](components) # test our screens components["$001"] = screens["testDialog"]() -print "*** classes:" -dump(screens) - -print "*** instances:" -dump(components) +#print "*** classes:" +#dump(screens) +# +#print "*** instances:" +#dump(components) # display @@ -100,7 +100,7 @@ class Session: self.currentWindow = None def keyEvent(self, code): - print "code " + str(code) +# print "code " + str(code) if code == 32: self.currentDialog.data["okbutton"]["instance"].push()