If there is no valid scanout, return NULL. Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxx> Acked-by: Pavel Grunt <pgrunt@xxxxxxxxxx> --- src/channel-display.c | 4 ++-- src/spice-widget.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/channel-display.c b/src/channel-display.c index 2c54df7..90d155e 100644 --- a/src/channel-display.c +++ b/src/channel-display.c @@ -532,7 +532,7 @@ void spice_display_change_preferred_compression(SpiceChannel *channel, gint comp * spice_display_get_gl_scanout: * @channel: a #SpiceDisplayChannel * - * Returns: the current GL scanout + * Returns: the current GL scanout, or %NULL if none or not valid * * Since: 0.31 **/ @@ -541,7 +541,7 @@ spice_display_get_gl_scanout(SpiceDisplayChannel *channel) { g_return_val_if_fail(SPICE_IS_DISPLAY_CHANNEL(channel), NULL); - return &channel->priv->scanout; + return channel->priv->scanout.fd != -1 ? &channel->priv->scanout : NULL; } /* ------------------------------------------------------------------ */ diff --git a/src/spice-widget.c b/src/spice-widget.c index 03c7cd8..a820ed2 100644 --- a/src/spice-widget.c +++ b/src/spice-widget.c @@ -2506,6 +2506,7 @@ static void gl_scanout(SpiceDisplay *display) g_return_if_fail(d->egl.context_ready); scanout = spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d->display)); + /* should only be called when the display has a scanout */ g_return_if_fail(scanout != NULL); if (!spice_egl_update_scanout(display, scanout, &err)) { -- 2.5.5 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel