[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Segmentation Fault
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Segmentation Fault
- From: Rene Dudfield <renesd@xxxxxxxxx>
- Date: Fri, 28 Oct 2005 09:05:36 +1000
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Thu, 27 Oct 2005 19:05:50 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=im/Rcj6uaqmSl2/mIJN625vC+489Sz95pqq1eEg1dFXof2kU4+mKJCWhw8zgXS0OzJmZSHO11EgqLzCEdCKx33ZFGNZQwm7HeRV6F2diC7Sg/Lrwr2jx01WYP8ngWgoyYQTcjLUhKAHM7oA3gijcuSGNg8MzaKh5z9CiAMCAhxg=
- In-reply-to: <20051027205813.GA1346@rosa.blake>
- References: <20051027205813.GA1346@rosa.blake>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Thanks.
That has been added to cvs.
I wonder if there was a reason for the extra surf =
PySurface_AsSurface(surface); line?
On 10/28/05, John Popplewell <john@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> [I sent this mail early this morning but it seems to have gone missing]
> Hi,
>
> I was working on a game and used:
>
> export set SDL_VIDEODRIVER=bobble
>
> to see what would happen with an invalid driver name.
> Bang! Turned out that the GP was triggered by this sequence:
>
> C:>python
> Python 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import pygame
> >>> pygame.init()
> (5, 1)
> >>> icon = pygame.image.load("icon32x32.png")
> >>> pygame.display.set_icon(icon)
> Fatal Python error: (pygame parachute) Segmentation Fault
>
> abnormal program termination
> C:>
>
> I tracked it down to the fact that SDL_WM_SetIcon() was being called even
> though SDL_Init(SDL_INIT_VIDEO) had failed.
>
> Happens on Linux as well as Windows. Not particularly important, but it wasted
> a chunk of my time.
>
> Here's a diff against current CVS that also removes some redundancy,
>
> cheers,
> John Popplewell.
>
> Index: display.c
> ===================================================================
> RCS file: /home/cvspsrv/cvsroot/games/pygame/src/display.c,v
> retrieving revision 1.64
> diff -c -r1.64 display.c
> *** display.c 3 Oct 2005 06:52:07 -0000 1.64
> --- display.c 27 Oct 2005 02:08:59 -0000
> ***************
> *** 919,925 ****
> static void do_set_icon(PyObject *surface)
> {
> SDL_Surface* surf = PySurface_AsSurface(surface);
> ! surf = PySurface_AsSurface(surface);
> SDL_WM_SetIcon(surf, NULL);
> icon_was_set = 1;
> }
> --- 919,925 ----
> static void do_set_icon(PyObject *surface)
> {
> SDL_Surface* surf = PySurface_AsSurface(surface);
> !
> SDL_WM_SetIcon(surf, NULL);
> icon_was_set = 1;
> }
> ***************
> *** 930,935 ****
> --- 930,937 ----
> PyObject* surface;
> if(!PyArg_ParseTuple(arg, "O!", &PySurface_Type, &surface))
> return NULL;
> + if(!PyGame_Video_AutoInit())
> + return RAISE(PyExc_SDLError, SDL_GetError());
> do_set_icon(surface);
> RETURN_NONE
> }
>
>
>