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

[pygame] bug in 1.7.1 -- random channel endevents (with patch and workaround)



hi all,

Quite recently the thing I am working on developed the habit of firing
apparently meaningless events, thus:

<Event(76-Unknown {})>
<Event(114-Unknown {})>
<Event(97-Unknown {})>
<Event(204-Unknown {})>
<Event(44-Unknown {})>
<Event(111-Unknown {})>

occasionally the series contains a 12, which tends to halt things, and
without which I might not have noticed.

I had a poke around and found that if you raise the number of mixer
channels (as I had), the reallocated memory is not properly initialised.
 This  can make any kind of event occur, or none, depending on the
previous state of the memory. The patch below should fix things,
although to be honest I have not actually compiled it, as it is simpler
to do something like this:

for i in range(mixer.get_num_channels()):
    mixer.Channel(i).set_endevent()


anyway, thanks for pygame.


Douglas Bagnall

-------------------

--- mixer.c     2005-08-11 18:14:27.000000000 +1200
+++ /tmp/mixer.c        2007-11-09 02:22:26.757467939 +1300
@@ -1130,6 +1130,7 @@
            {
                channeldata[i].sound = NULL;
                channeldata[i].queue = NULL;
+               channeldata[i].endevent = 0;
            }