Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 452920 - Segmentation Fault when working adding Widget into Grid
Summary: Segmentation Fault when working adding Widget into Grid
Alias: None
Product: Fedora
Classification: Fedora
Component: newt
Version: rawhide
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Miroslav Lichvar
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2008-06-25 21:15 UTC by Greg Swift
Modified: 2008-09-10 07:05 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-07-30 13:29:59 UTC

Attachments (Terms of Use)

Description Greg Swift 2008-06-25 21:15:53 UTC
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):

How reproducible:

Steps to Reproduce:
1. Run this script (built my stripping down the example code at listed URL):

#!/usr/bin/env python

from snack import *

s = SnackScreen()
g = Grid(1,1)
w = Widget()
s.gridWrappedWindow(g, "title")

Actual Results:
Segmentation Fault

Expected Results:
Nothing special if anything, but at the very least an exception being raised based on invalid object.

Additional info:
I've tried this on the following rpms:


Comment 1 Miroslav Lichvar 2008-06-26 15:14:35 UTC
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.

Comment 2 Greg Swift 2008-06-26 15:45:33 UTC
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:

class Widget:
    """Base class for NEWT toolkit - Do not use directly


     - Widget(self)
     - setCallback(self, obj, data = None) :
          The callback for when object activated.
          data is passed to obj.
    def setCallback(self, obj, data = None):
        if data:
            self.w.setCallback(obj, data)

    def __init__(self):
        raise NotImplementedError

This was per the definition located at Python's Module Exception page[1], which
"exception NotImplementedError
    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.


Comment 3 John Poelstra 2008-06-27 02:58:59 UTC

Comment 4 Miroslav Lichvar 2008-06-27 11:45:46 UTC
Ok, I've put the fix in upstream git. Will be in the next release.


Comment 5 Greg Swift 2008-06-27 15:30:21 UTC
awesome.  thanks.

Comment 6 Miroslav Lichvar 2008-07-30 13:29:59 UTC
Fixed in newt-0.52.10-1.fc10.

Comment 7 Fedora Update System 2008-07-30 13:42:36 UTC
newt-0.52.10-1.fc9 has been submitted as an update for Fedora 9

Comment 8 Fedora Update System 2008-09-10 07:05:41 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.