Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yunline committed Oct 15, 2023
1 parent 892e8dc commit f998095
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src_c/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ window_destroy(pgWindowObject *self, PyObject *_null)
self->_win = NULL;
}
if (self->surf) {
// Set the internal surface to NULL to make pygame surface invalid
// since this surface will be deallocated by SDL when the window is
// destroyed.
self->surf->surf = NULL;

Py_DECREF(self->surf);
self->surf = NULL;
}
Expand Down Expand Up @@ -685,7 +689,11 @@ window_dealloc(pgWindowObject *self, PyObject *_null)
}
}
if (self->surf) {
// Set the internal surface to NULL to make pygame surface invalid
// since this surface will be deallocated by SDL when the window is
// destroyed.
self->surf->surf = NULL;

Py_DECREF(self->surf);
}

Expand Down

0 comments on commit f998095

Please sign in to comment.