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

Re: [pygame] Pygame crashes reliably when clicking away.



It works fine for me with 32-bit Python 3.2 and Python 2.7, running on Windows 7:
Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (Intel)] on win32
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32

I am running slightly newer pygames than you are.
On Python 3.2, I'm running Lenard's latest pre-alpha pygame.
On Python 2.7, I'm running a year-old (04/04/2011) pygame-1.9.2a0-py2.7.

The only thing I changed in your program was the print syntax, so that it'll run on both 2.7 and 3.2:


import pygame
from time import sleep, time

start = time()
pygame.init()

SCREEN_SIZE = (640,480)

screen = pygame.display.set_mode(SCREEN_SIZE)

while True:
 for event in pygame.event.get():
  if event.type != pygame.MOUSEMOTION:
    print("%0.3f" % (time() - start), event)
  if event.type == pygame.QUIT: exit()
 sleep(0.01)



Here's the output (Python 3.2 first, then Python 2.7):

c:\Users\Dave\Documents\Python>DanUznanski.py
0.697 <Event(17-VideoExpose {})>
0.698 <Event(16-VideoResize {'h': 480, 'w': 640, 'size': (640, 480)})>
0.698 <Event(1-ActiveEvent {'state': 1, 'gain': 0})>
1.739 <Event(1-ActiveEvent {'state': 1, 'gain': 1})>
2.667 <Event(1-ActiveEvent {'state': 1, 'gain': 0})>
3.825 <Event(1-ActiveEvent {'state': 2, 'gain': 0})>
4.906 <Event(1-ActiveEvent {'state': 1, 'gain': 1})>
5.246 <Event(17-VideoExpose {})>
5.248 <Event(1-ActiveEvent {'state': 6, 'gain': 1})>
5.250 <Event(5-MouseButtonDown {'button': 1, 'pos': (30, 331)})>
5.421 <Event(6-MouseButtonUp {'button': 1, 'pos': (30, 331)})>
5.612 <Event(1-ActiveEvent {'state': 1, 'gain': 0})>
5.856 <Event(1-ActiveEvent {'state': 2, 'gain': 0})>
7.209 <Event(1-ActiveEvent {'state': 1, 'gain': 1})>
9.327 <Event(17-VideoExpose {})>
9.328 <Event(1-ActiveEvent {'state': 6, 'gain': 1})>
9.329 <Event(5-MouseButtonDown {'button': 1, 'pos': (15, 306)})>
9.550 <Event(6-MouseButtonUp {'button': 1, 'pos': (15, 306)})>
9.826 <Event(1-ActiveEvent {'state': 1, 'gain': 0})>
13.389 <Event(1-ActiveEvent {'state': 2, 'gain': 0})>
14.068 <Event(1-ActiveEvent {'state': 1, 'gain': 1})>
14.296 <Event(17-VideoExpose {})>
14.297 <Event(1-ActiveEvent {'state': 6, 'gain': 1})>
14.298 <Event(5-MouseButtonDown {'button': 1, 'pos': (73, 172)})>
14.460 <Event(6-MouseButtonUp {'button': 1, 'pos': (73, 165)})>
14.532 <Event(1-ActiveEvent {'state': 1, 'gain': 0})>
15.416 <Event(1-ActiveEvent {'state': 2, 'gain': 0})>
16.347 <Event(1-ActiveEvent {'state': 1, 'gain': 1})>
16.971 <Event(17-VideoExpose {})>
16.972 <Event(1-ActiveEvent {'state': 6, 'gain': 1})>
16.972 <Event(5-MouseButtonDown {'button': 1, 'pos': (44, 99)})>
17.172 <Event(6-MouseButtonUp {'button': 1, 'pos': (44, 98)})>
17.627 <Event(1-ActiveEvent {'state': 1, 'gain': 0})>
18.072 <Event(1-ActiveEvent {'state': 2, 'gain': 0})>
18.763 <Event(1-ActiveEvent {'state': 1, 'gain': 1})>
19.371 <Event(17-VideoExpose {})>
19.372 <Event(1-ActiveEvent {'state': 6, 'gain': 1})>
19.372 <Event(5-MouseButtonDown {'button': 1, 'pos': (31, 225)})>
19.552 <Event(6-MouseButtonUp {'button': 1, 'pos': (31, 225)})>
20.372 <Event(1-ActiveEvent {'state': 1, 'gain': 0})>
21.294 <Event(12-Quit {})>

c:\Users\Dave\Documents\Python>\python27\python DanUznanski.py
('0.782', <Event(17-VideoExpose {})>)
('0.786', <Event(1-ActiveEvent {'state': 1, 'gain': 0})>)
('2.273', <Event(1-ActiveEvent {'state': 1, 'gain': 1})>)
('2.296', <Event(1-ActiveEvent {'state': 1, 'gain': 0})>)
('4.032', <Event(1-ActiveEvent {'state': 1, 'gain': 1})>)
('5.223', <Event(1-ActiveEvent {'state': 1, 'gain': 0})>)
('5.616', <Event(1-ActiveEvent {'state': 1, 'gain': 1})>)
('5.969', <Event(5-MouseButtonDown {'button': 1, 'pos': (494, 187)})>)
('6.134', <Event(6-MouseButtonUp {'button': 1, 'pos': (495, 186)})>)
('6.347', <Event(1-ActiveEvent {'state': 1, 'gain': 0})>)
('6.633', <Event(1-ActiveEvent {'state': 2, 'gain': 0})>)
('7.409', <Event(1-ActiveEvent {'state': 1, 'gain': 1})>)
('7.769', <Event(17-VideoExpose {})>)
('7.773', <Event(1-ActiveEvent {'state': 6, 'gain': 1})>)
('7.778', <Event(5-MouseButtonDown {'button': 1, 'pos': (67, 207)})>)
('7.912', <Event(6-MouseButtonUp {'button': 1, 'pos': (76, 186)})>)
('8.036', <Event(1-ActiveEvent {'state': 1, 'gain': 0})>)
('8.773', <Event(1-ActiveEvent {'state': 2, 'gain': 0})>)
('9.790', <Event(1-ActiveEvent {'state': 1, 'gain': 1})>)
('10.088', <Event(17-VideoExpose {})>)
('10.090', <Event(1-ActiveEvent {'state': 6, 'gain': 1})>)
('10.091', <Event(5-MouseButtonDown {'button': 1, 'pos': (38, 189)})>)
('10.274', <Event(6-MouseButtonUp {'button': 1, 'pos': (40, 188)})>)
('10.557', <Event(1-ActiveEvent {'state': 1, 'gain': 0})>)
('10.860', <Event(1-ActiveEvent {'state': 2, 'gain': 0})>)
('11.811', <Event(1-ActiveEvent {'state': 1, 'gain': 1})>)
('12.239', <Event(17-VideoExpose {})>)
('12.240', <Event(1-ActiveEvent {'state': 6, 'gain': 1})>)
('12.244', <Event(5-MouseButtonDown {'button': 1, 'pos': (29, 232)})>)
('12.406', <Event(6-MouseButtonUp {'button': 1, 'pos': (33, 231)})>)
('12.978', <Event(1-ActiveEvent {'state': 1, 'gain': 0})>)
('13.672', <Event(12-Quit {})>)


Does your computer have other flakiness/weirdness?  Maybe it's time for a RAM test, and some antivirus scans:  perhaps TDSSkiller, then MalwareBytes free version, then ESET Online Scanner.

Dave


On Sat, Mar 17, 2012 at 3:51 PM, Dan Uznanski <duznanski@xxxxxxxxx> wrote:
I've started building a little pygame program.  Unfortunately I've
been having a huge problem: the second time I click out of the window
on another thing that completely obscures the pygame window, using
pygame.event.get() crashes with a segfault.

I'm running Windows XP/32 latest on 2009 mac pro hardware, Python
2.7.2, Pygame 1.9.1.

Here's code:

#---begin code---
import pygame
from time import sleep, time

start = time()
pygame.init()

SCREEN_SIZE = (640,480)

screen = pygame.display.set_mode(SCREEN_SIZE)

while True:
 for event in pygame.event.get():
  if event.type != pygame.MOUSEMOTION:
    print "%0.3f" % (time() - start), event
  if event.type == pygame.QUIT: exit()
 sleep(0.01)
# ---end code---

And here's logs of one attempt:

#---begin logs---
D:\vornda>C:\python27\python.exe cheese.py
0.156 <Event(17-VideoExpose {})>
0.156 <Event(1-ActiveEvent {'state': 1, 'gain': 0})>
1.344 <Event(1-ActiveEvent {'state': 2, 'gain': 0})>
5.938 <Event(17-VideoExpose {})>
5.938 <Event(1-ActiveEvent {'state': 6, 'gain': 1})>
5.938 <Event(5-MouseButtonDown {'button': 1, 'pos': (356, 479)})>
7.109 <Event(5-MouseButtonDown {'button': 1, 'pos': (356, 479)})>
Fatal Python error: (pygame parachute) Segmentation Fault

This application has requested the Runtime to terminate it in an
unusual way.
Please contact the application's support team for more information.
#---end logs---