Red Hat Bugzilla – Bug 452920
Segmentation Fault when working adding Widget into Grid
Last modified: 2008-09-10 03:05:53 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008052912 Firefox/3.0
Description of problem:
I found a tutorial about using Newt in Python. The first example under Forms and Grids segfaults. If I change their use of Widget to any of the classes based on Widget it seems to work fine. I realize that this may just mean that you should never use Widget directly, but it should handle it without a segfault, IMHO.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Run this script (built my stripping down the example code at listed URL):
from snack import *
s = SnackScreen()
g = Grid(1,1)
w = Widget()
Nothing special if anything, but at the very least an exception being raised based on invalid object.
I've tried this on the following rpms:
I'm not sure the example has ever worked. Widget just provides the setCallback
function and isn't supposed to be used as a real widget.
Any suggestions where the exception should be raised? Checking in all functions
if w == None wouldn't be very nice.
Okay.. I'll concede that checking that in every function is not nice. After
your response and having browsed through the source would these 2 assumptions be
1: You shouldn't be using Widget directly, ever?
2: Whenever inheriting Widget you should override the __init__ method
If so You could always do this:
"""Base class for NEWT toolkit - Do not use directly
- setCallback(self, obj, data = None) :
The callback for when object activated.
data is passed to obj.
def setCallback(self, obj, data = None):
This was per the definition located at Python's Module Exception page, which
This exception is derived from RuntimeError. In user defined base classes,
abstract methods should raise this exception when they require derived classes
to override the method. New in version 1.5.2. "
Of course if the above 2 assumptions are not true, I'm going to have to think
about it a bit more.
Ok, I've put the fix in upstream git. Will be in the next release.
Fixed in newt-0.52.10-1.fc10.
newt-0.52.10-1.fc9 has been submitted as an update for Fedora 9
newt-0.52.10-1.fc9 has been pushed to the Fedora 9 stable repository. If problems still persist, please make note of it in this bug report.