[Bug 427372] New: libyui/python (ncurses+qt): crash when using YTable widget
https://bugzilla.novell.com/show_bug.cgi?id=427372 Summary: libyui/python (ncurses+qt): crash when using YTable widget Product: openSUSE 11.0 Version: Final Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: YaST2 AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: dl9pf@gmx.de QAContact: jsrain@novell.com Found By: Community User Steps to reproduce: Compile libyui and bindings from svn (should crash on earlier versions,too). Use this code example: import yui factory = yui.YUI.widgetFactory() dialog = self.factory.createMainDialog() VBox = factory.createVBox(dialog) yTableHeader = yui.YTableHeader() yTableHeader.addColumn("aaaaa") yTableHeader.addColumn("bbbbb") yTableHeader.addColumn("ccccc") yTableHeader.addColumn("ddddd") myTableMinSize = factory.createMinSize(VBox, 50, 12) myTable = factory.createTable(myTableMinSize, yTableHeader) # note YItemCollection seems unavailable ! myItem = yui.YTableItem("X", "foo", "1.2.1", "qwertz") myTable.addItem(myItem) myItem2 = yui.YTableItem("", "bar", "1.3.1", "asdasdasd") myTable.addItem(myItem2) event1 = dialog.waitForEvent() myTable.deleteAllItems() myItem3 = yui.YTableItem("X3", "foo3", "1.2.13", "qwertz3") myTable.addItem(myItem3) myItem4 = yui.YTableItem("4", "bar4", "1.3.14", "asdasdasd4") myTable.addItem(myItem4) # should already have crashed event2 = dialog.waitForEvent() event3 = dialog.waitForEvent() dialog.destroy() -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=427372
Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User dl9pf@gmx.de added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c1
--- Comment #1 from Jan-Simon Möller
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c2
--- Comment #2 from Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c3
--- Comment #3 from Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c4
Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c5
--- Comment #5 from Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User sh@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c6
--- Comment #6 from Stefan Hundhammer
https://bugzilla.novell.com/show_bug.cgi?id=427372
User sh@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c7
--- Comment #7 from Stefan Hundhammer
https://bugzilla.novell.com/show_bug.cgi?id=427372
User sh@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c8
--- Comment #8 from Stefan Hundhammer
https://bugzilla.novell.com/show_bug.cgi?id=427372
Stefan Hundhammer
https://bugzilla.novell.com/show_bug.cgi?id=427372
User dl9pf@gmx.de added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c9
Jan-Simon Möller
This is the log output right after the program was started, with the dialog still open.
The next click into the table will of course reference the now-deleted items, which results in a segfault.
We need to tell Python and/or SWIG that YTable (like all YSelectionWidget subclasses) assumes ownership of items added with addItem() or addItems() - and of the YTableHeader, too.
-> back to libyui-bindings maintainer
Thinking over it and looking at the code (why does #1 work and #2 not) I think I made a mistake: the items are local variables to __init__ and adding them as self.item<N> should work - which i did in my original code :/. I also need to alter the tables content. E.g. change single Cell or fill complete table with other values. Posting complete example code (which still crashes). -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=427372
User dl9pf@gmx.de added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c10
--- Comment #10 from Jan-Simon Möller
https://bugzilla.novell.com/show_bug.cgi?id=427372
User dl9pf@gmx.de added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c11
--- Comment #11 from Jan-Simon Möller
https://bugzilla.novell.com/show_bug.cgi?id=427372
User dl9pf@gmx.de added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c12
--- Comment #12 from Jan-Simon Möller
From YSelectionWidget.cc:
[...] void YSelectionWidget::deleteAllItems() { YItemIterator it = itemsBegin(); while ( it != itemsEnd() ) { YItem * item = *it; ++it; delete item; // No need to check for item->hasChildren() and iterate recursively // over the children: The item will take care of its children in its // destructor. } priv->itemCollection.clear(); } [...] Here the Items are deleted. I'd need just priv->itemCollection.clear(), right ? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=427372
User dl9pf@gmx.de added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c13
--- Comment #13 from Jan-Simon Möller
factory = yui.YUI.widgetFactory() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: widgetFactory() takes exactly 1 argument (0 given) factory = yui.YUI.widgetFactory("") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/yuitest/lib64/python2.5/site-packages/yui.py", line 171, in widgetFactory return _yui.YUI_widgetFactory(self) TypeError: YUI_widgetFactory() takes exactly 0 arguments (1 given)
-- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=427372
User dl9pf@gmx.de added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c14
--- Comment #14 from Jan-Simon Möller
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c15
--- Comment #15 from Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c16
Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User sh@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c17
Stefan Hundhammer
https://bugzilla.novell.com/show_bug.cgi?id=427372
Stefan Hundhammer
https://bugzilla.novell.com/show_bug.cgi?id=427372
Stefan Hundhammer
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c18
--- Comment #18 from Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User sh@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c19
--- Comment #19 from Stefan Hundhammer
https://bugzilla.novell.com/show_bug.cgi?id=427372
User sh@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c20
Stefan Hundhammer
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c21
--- Comment #21 from Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c22
--- Comment #22 from Klaus Kämpf
Great, thanks.
YTableHeader:addColumn is certainly a candidate ;-)
No, its not. String references apparently are no problem. The real culprit was passing the YTableHeader pointer to YWidgetFactory::createTable(). Fixed in libyui svn rev 54677. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c23
Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c24
Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User kkaempf@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c25
Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=427372
User dl9pf@gmx.de added comment
https://bugzilla.novell.com/show_bug.cgi?id=427372#c26
--- Comment #26 from Jan-Simon Möller
participants (1)
-
bugzilla_noreply@novell.com