diff src/bufferproxy.c @ 1137:ec3ced33488f

Reworked locking code to be more strict about locking. Added Surface.get_locks() method.
author marcus
date Mon, 16 Jun 2008 18:46:56 +0000
parents 3cc4c037f5ef
children c0d170c1e636 134f8fe8d639
line wrap: on
line diff
--- a/src/bufferproxy.c	Mon Jun 16 13:40:05 2008 +0000
+++ b/src/bufferproxy.c	Mon Jun 16 18:46:56 2008 +0000
@@ -23,18 +23,6 @@
 #include "pygame.h"
 #include "pygamedocs.h"
 
-typedef struct
-{
-    PyObject_HEAD
-    PyObject *dict;     /* dict for subclassing */
-    PyObject *weakrefs; /* Weakrefs for subclassing */
-    void *buffer;       /* Pointer to the buffer of the parent object. */
-    Py_ssize_t length;  /* Length of the buffer. */
-    PyObject *parent;   /* Parent object associated with this object. */
-    PyObject *lock;     /* Lock object for the surface. */
-
-} PyBufferProxy;
-
 static PyObject* _bufferproxy_new (PyTypeObject *type, PyObject *args,
                                    PyObject *kwds);
 static void _bufferproxy_dealloc (PyBufferProxy *self);
@@ -178,10 +166,8 @@
 {
     if (self->weakrefs)
         PyObject_ClearWeakRefs ((PyObject *) self);
-    if (self->lock)
-    {
-        Py_DECREF (self->lock);
-    }
+
+    Py_XDECREF (self->lock);
     Py_XDECREF (self->dict);
     self->ob_type->tp_free ((PyObject *) self);
 }