[PATCH 1/5] wined3d: Correctly destroy the adapter on format initialization failure in no3d mode.

Henri Verbeet hverbeet at gmail.com
Fri Jul 17 04:30:08 CDT 2020

On Thu, 16 Jul 2020 at 21:20, Matteo Bruni <mbruni at codeweavers.com> wrote:
> @@ -2990,7 +2990,7 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal,
>      if (!wined3d_adapter_no3d_init_format_info(adapter))
>      {
> -        heap_free(adapter);
> +        adapter_no3d_destroy(adapter);
>          return NULL;
>      }
It happens to be the case that adapter_no3d_destroy() does the right
thing, but I'd argue that conceptually it's more questionable. I.e.,
conceptually adapter_no3d_destroy() is the counterpart to
wined3d_adapter_no3d_create(), and consists of
wined3d_adapter_no3d_cleanup() + heap_free(). As it turns out, neither
wined3d_adapter_no3d_init() nor wined3d_adapter_no3d_cleanup()
actually exist, because at least at the time,
wined3d_adapter_no3d_init() was considered trivial enough to just fold
into wined3d_adapter_no3d_create(), and wined3d_adapter_no3d_cleanup()
would likewise simply call wined3d_adapter_cleanup(). Nevertheless, we
still don't have a fully initialised no3d adapter to pass to
adapter_no3d_destroy() here.

More information about the wine-devel mailing list