[Spice-commits] configure.ac server/display-channel.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Fri Aug 25 08:38:38 UTC 2017
configure.ac | 3 +++
server/display-channel.c | 24 ++++++++++++++++++++++++
2 files changed, 27 insertions(+)
New commits:
commit 8cdea23d1d46a9a51fdbd655f45a62185a2e8427
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Feb 28 11:11:56 2017 +0000
display-channel: Check that all structure are destroyed during finalize
The leak detector we use currently is not enough to detect
some kind of leak in DisplayChannel so manually test.
These tests are enabled only when --enable-extra-checks is passed
to configure.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/configure.ac b/configure.ac
index e1e74862..a840eebd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -247,6 +247,9 @@ AC_ARG_ENABLE([extra-checks],
AS_HELP_STRING([--enable-extra-checks=@<:@yes/no@:>@],
[Enable expensive checks @<:@default=no@:>@]))
AM_CONDITIONAL(ENABLE_EXTRA_CHECKS, test "$enable_extra_checks" = "yes")
+AC_DEFINE_UNQUOTED([ENABLE_EXTRA_CHECKS],
+ [$(test "x$enable_extra_checks" = xyes && echo 1 || echo 0)],
+ [Define to 1 to enable extra checks on code otherwise define to 0])
dnl ===========================================================================
dnl check compiler flags
diff --git a/server/display-channel.c b/server/display-channel.c
index 83ac692f..792fbd25 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -80,6 +80,30 @@ display_channel_finalize(GObject *object)
display_channel_destroy_surfaces(self);
image_cache_reset(&self->priv->image_cache);
+
+ if (ENABLE_EXTRA_CHECKS) {
+ unsigned int count;
+ _Drawable *drawable;
+ Stream *stream;
+
+ count = 0;
+ for (drawable = self->priv->free_drawables; drawable; drawable = drawable->u.next) {
+ ++count;
+ }
+ spice_assert(count == NUM_DRAWABLES);
+
+ count = 0;
+ for (stream = self->priv->free_streams; stream; stream = stream->next) {
+ ++count;
+ }
+ spice_assert(count == NUM_STREAMS);
+ spice_assert(ring_is_empty(&self->priv->streams));
+
+ for (count = 0; count < NUM_SURFACES; ++count) {
+ spice_assert(self->priv->surfaces[count].context.canvas == NULL);
+ }
+ }
+
monitors_config_unref(self->priv->monitors_config);
g_array_unref(self->priv->video_codecs);
g_free(self->priv);
More information about the Spice-commits
mailing list