[PATCH 4/8] ddraw: Just return an error if we failed to find the predecessor in ddraw_surface_delete_attached_surface().
Henri Verbeet
hverbeet at codeweavers.com
Tue Mar 15 10:55:11 CDT 2016
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
dlls/ddraw/surface.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 9e28655..3709b94 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -1982,16 +1982,16 @@ static HRESULT ddraw_surface_delete_attached_surface(struct ddraw_surface *surfa
}
/* Find the predecessor of the detached surface */
- while (prev)
+ while (prev->next_attached != attachment)
{
- if (prev->next_attached == attachment)
- break;
- prev = prev->next_attached;
+ if (!(prev = prev->next_attached))
+ {
+ ERR("Failed to find predecessor of %p.\n", attachment);
+ wined3d_mutex_unlock();
+ return DDERR_SURFACENOTATTACHED;
+ }
}
- /* There must be a surface, otherwise there's a bug */
- assert(prev);
-
/* Unchain the surface */
prev->next_attached = attachment->next_attached;
attachment->next_attached = NULL;
--
2.1.4
More information about the wine-patches
mailing list