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

Re: [pygame] event getting corrupted





On Wed, Sep 16, 2009 at 3:36 PM, Bo Jangeborg <bo@xxxxxxxxxxx> wrote:
I have seen a troubling error for some time now.
Occasionally I get a segmentation error with no indication of what
went wrong. The error is not repeatable in a reliable way and I get
no error trace. Repeating the error can take hours.

After seeing this I have tried to pin down, with the debugger running,
what's going wrong but the nearest I can get is that the event object
gets turned into a long at different times.

Running with a debugger I got this trace. I have included the calling
line were you can see that the event seem to be correct, but at some
point the event object seem to become corrupted.
Included is also the code between the call and the eventual point
of error. I am at loss at what may be going wrong.

Bo)

Traceback (most recent call last):
 File "C:\Program Files\eclipse\plugins\org.python.pydev.debug_1.4.7.2843\pysrc\pydevd.py", line 881, in <module>
  debugger.run(setup['file'], None, None)
 File "C:\Program Files\eclipse\plugins\org.python.pydev.debug_1.4.7.2843\pysrc\pydevd.py", line 710, in run
  execfile(file, globals, locals) #execute the script
 File "C:\Projekt\eclipse\Pyos\Program\Solitaire\solitaire.py", line 761, in <module>
  main()
 File "C:\Projekt\eclipse\Pyos\Program\Solitaire\solitaire.py", line 80, in main
  if screen.main_loop(app):
 File "C:\Projekt\eclipse\Pyos\System\widgets\gui.py", line 328, in main_loop
  = self.mouse_button_up(event, mob_pos, mousemove)
 File "C:\Projekt\eclipse\Pyos\System\widgets\gui.py", line 573, in mouse_button_up
  if event.button == 1:
AttributeError: 'long' object has no attribute 'button'




 
elif event.type is MOUSEBUTTONUP:
   mob_pos, mousemove, mouse_pos, hit_pos \
               = self.mouse_button_up(event, mob_pos, mousemove)




 a ha

    def mouse_button_up(self, event, mob_pos, mousemove): 
      ''' handle mouse button up events'''
      mousebtn_event = False
      mouse_pos = event.pos
      widget, hit_pos = self.mouse_hit_widget(mouse_pos[0],
                                          mouse_pos[1])
      if widget is None or not widget.enabled:
          self.moving_object = None
          self.repeating_object = None
          self.last_over_drop_widget = None
      else:
          event_data = {'hit_pos':hit_pos, 'over_widget':widget}
          event_data['gui'] = self
          if widget and widget.exists('event_click_release_data'):
              event_data.update(widget.event_click_release_data)
          #InsideButton  (Left)
          if event.button == 1:


a ha
Well, from where comes event ?

--
claudio