Re: [PyKDE] Segmentation fault with QTabBar/QTab

2002-06-11 Thread Thierry Jouve

Hi,

   same thing for me, using PyQt 3.1, Qt 3.0.2, python 2.1.1

Regards,

--
   Thierry

Kaercher, Joerg wrote:
 
 Hi,
 
 I am trying to use the QTabBar/QTab classes and get a segmentation fault
 when a tab is removed from the bar. I found a message in the PyKDE archive
 that mentions that on the C++ level QTabBar::removeTab() calls the
 destructor for the QTab object. Is it possible that the garbage collector in
 Python tries to do the same and thereby causes the segementation fault? Any
 ideas? (I am using PyQt 3.2.4 and Qt 3.0.4 under Linux)
 
 Thanks.
 
 Joerg
 
 Here is a short sample program that demonstrates the problem. The second
 setNumTabs() call crashes the program.
 
 import qt
 import sys
 
 class TabBar(qt.QTabBar):
 def clear(self):
 for n in range(self.count()):
 self.removeTab(self.tab(n))
 def setNumTabs(self,num):
 self.clear()
 for n in range(num):
 self.insertTab(qt.QTab('%d'%(n+1)),n)
 
 a=qt.QApplication(sys.argv)
 
 w=TabBar()
 w.setNumTabs(5)
 w.setNumTabs(7)
 
 a.setMainWidget(w)
 w.show()
 a.exec_loop()
 
 ___
 PyKDE mailing list[EMAIL PROTECTED]
 http://mats.gmd.de/mailman/listinfo/pykde

--
   Thierry JOUVE

   BLISS GROUP - ESRF
   Mail : [EMAIL PROTECTED], Office : 155b, Tel : 29-46

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde



Re: [PyKDE] Segmentation fault with QTabBar/QTab

2002-06-10 Thread Phil Thompson

Kaercher, Joerg wrote:

 Hi,
 
 I am trying to use the QTabBar/QTab classes and get a segmentation fault
 when a tab is removed from the bar. I found a message in the PyKDE archive
 that mentions that on the C++ level QTabBar::removeTab() calls the
 destructor for the QTab object. Is it possible that the garbage collector in
 Python tries to do the same and thereby causes the segementation fault? Any
 ideas? (I am using PyQt 3.2.4 and Qt 3.0.4 under Linux)


Yes, that's exactly what's happening.

If you are happy to regenerate the C++ code then remove the 
/TransferBack/ from removeTab() in qtabbar.sip.

Otherwise change mJ4 to mJ0 on line 2917 of sipqtQTabBar.cpp.

Let me know if this solves the problem.

Phil

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde