fixed refcount of eListboxPythonStringContent
authorFelix Domke <tmbinc@elitedvb.net>
Sat, 29 Jan 2005 00:19:00 +0000 (00:19 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sat, 29 Jan 2005 00:19:00 +0000 (00:19 +0000)
components.py
lib/gui/elistbox.cpp
lib/python/enigma_python.i
mytest.py

index 2082718..52c9460 100644 (file)
@@ -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
index 96214ae..e06ab3e 100644 (file)
@@ -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!");
 }
index b84dbd1..ae15d0d 100644 (file)
@@ -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<void,int> &keyPressedSignal();
 %}
 
+RefCount(eListboxPythonStringContent)
+
 #define DEBUG
 %include "stl.i"
 %include <lib/base/object.h>
index 5233d85..e4a722a 100644 (file)
--- 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()