Rémi Bernon (@rbernon) commented about dlls/winewayland.drv/window.c:
- pthread_mutex_lock(&win_data_mutex);
- if ((data = win_data_context[context_idx(hwnd)]) && data->hwnd == hwnd)
return data;
- pthread_mutex_unlock(&win_data_mutex);
- return NULL;
+}
+/***********************************************************************
wayland_win_data_release
- Release the data returned by wayland_win_data_get.
- */
+static void wayland_win_data_release(struct wayland_win_data *data) +{
- if (data) pthread_mutex_unlock(&win_data_mutex);
I think NULL should not be accepted here.
I can see that the code is adapted pretty much pristine from winex11, but in my opinion it is not necessarily a good reference. Having a new driver should be an occasion to write better code, not one to duplicate (potentially not great) code. The winex11 driver works well, yes, but it is also extremely difficult to refactor. It would be great not to spread that difficulty.
For instance, the window data creation pattern `if (!get && !create)` looks awkward and racy at first as it is unguarded. It is only working because of how `WindowPosChanging` is called, and I don't think we should rely on this.