If a window with border is set to "border none" and then closed, we would
call cairo_destroy / cairo_surface_destroy twice, causing an assertion
failure in cairo as the objects already had zero references the second
time. We fix this by explicitly setting these objects to NULL.
relates to #1278
#ifdef CAIRO_SUPPORT
cairo_surface_destroy(surface->surface);
cairo_destroy(surface->cr);
+
+ /* We need to explicitly set these to NULL to avoid assertion errors in
+ * cairo when calling this multiple times. This can happen, for example,
+ * when setting the border of a window to none and then closing it. */
+ surface->surface = NULL;
+ surface->cr = NULL;
#endif
}