[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Segmentation Fault?




Ok. So I ``fixed'' this by changing:

def blitToBG(self, surface, pos):
# Routine to change the bg of this screen.
self.bg.blit(surface, pos)
self.bg_clear.blit(surface, pos)

to

def blitToBG(self, surface, pos):
# Routine to change the bg of this screen.
surface.set_colorkey(surface.get_at((0,0)))
self.bg.blit(surface, pos)
self.bg_clear.blit(surface, pos)

I'm totally confused, but happy to continue development. Does anyone have *any* idea what is going on here?

Thanks,
Glen

----- Original Message ----- From: "Glen Wheeler" <adsl5lcq@tpg.com.au>
To: <pygame-users@seul.org>
Sent: Thursday, November 25, 2004 3:54 PM
Subject: [pygame] Segmentation Fault?



Greetings fellow pygame developers.

Today I have reached a very interesting problem. At a particular blit in
my game, the whole thing fails with:

Pygame Parachute Traceback:
File "main.py", line 486, in blitToBG
Fatal Python error: (pygame parachute) Segmentation Fault

This application has requested the Runtime o terminate it in an unusual way.
Please contact the application's support team for more information.

Strange since I am used to seeing much more helpful python tracebacks.
Anyway, the function blitToBG simply takes a surface and a position then
blits the two. The function is used many more times than just that one
time! The thing fails at the same place every time. In fact, the function
blitToBG is so simple I'm placing it here:

def blitToBG(self, surface, pos):
# Routine to change the bg of this screen.
self.bg.blit(surface, pos)
self.bg_clear.blit(surface, pos)

The line where it fails is: self.bg_clear.blit(surface, pos). bg_clear is
a surface with a colourkey, bg is a fully opaque version. The really weird
thing is that the images I'm asking the thing to blit have been blitted to
other backgrounds earlier, using that same function! I just don't
understand it at all. pos is passed in correctly, the same co-ordinates are
used earlier. surface is just a convert()ed image loaded with a colourkey.

Does anyone have an idea?

Thanks in advance,
Glen