dmabufdownloader: Add a close() function

We need to unrealize renderers before unreffing them. This vfunc takes
care of that.
This commit is contained in:
Benjamin Otte 2023-12-19 18:49:22 +01:00
parent ce04dfad41
commit 74620ffc46
4 changed files with 25 additions and 1 deletions

View File

@ -395,7 +395,13 @@ gdk_display_dispose (GObject *object)
gsize i;
for (i = 0; i < G_N_ELEMENTS (display->dmabuf_downloaders); i++)
g_clear_object (&display->dmabuf_downloaders[i]);
{
if (display->dmabuf_downloaders[i] == NULL)
continue;
gdk_dmabuf_downloader_close (display->dmabuf_downloaders[i]);
g_clear_object (&display->dmabuf_downloaders[i]);
}
_gdk_display_manager_remove_display (gdk_display_manager_get (), display);

View File

@ -9,6 +9,15 @@ gdk_dmabuf_downloader_default_init (GdkDmabufDownloaderInterface *iface)
{
}
void
gdk_dmabuf_downloader_close (GdkDmabufDownloader *self)
{
GdkDmabufDownloaderInterface *iface;
iface = GDK_DMABUF_DOWNLOADER_GET_IFACE (self);
iface->close (self);
}
gboolean
gdk_dmabuf_downloader_supports (GdkDmabufDownloader *self,
GdkDmabufTexture *texture,

View File

@ -13,6 +13,7 @@ struct _GdkDmabufDownloaderInterface
{
GTypeInterface g_iface;
void (* close) (GdkDmabufDownloader *downloader);
gboolean (* supports) (GdkDmabufDownloader *downloader,
GdkDmabufTexture *texture,
GError **error);
@ -23,6 +24,7 @@ struct _GdkDmabufDownloaderInterface
gsize stride);
};
void gdk_dmabuf_downloader_close (GdkDmabufDownloader *downloader);
gboolean gdk_dmabuf_downloader_supports (GdkDmabufDownloader *downloader,
GdkDmabufTexture *texture,
GError **error);

View File

@ -127,9 +127,16 @@ gsk_gl_renderer_dmabuf_downloader_download (GdkDmabufDownloader *downloader_,
gdk_gl_context_clear_current ();
}
static void
gsk_gl_renderer_dmabuf_downloader_close (GdkDmabufDownloader *downloader)
{
gsk_renderer_unrealize (GSK_RENDERER (downloader));
}
static void
gsk_gl_renderer_dmabuf_downloader_init (GdkDmabufDownloaderInterface *iface)
{
iface->close = gsk_gl_renderer_dmabuf_downloader_close;
iface->supports = gsk_gl_renderer_dmabuf_downloader_supports;
iface->download = gsk_gl_renderer_dmabuf_downloader_download;
}