From: Rémi Bernon <rbernon@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59350 --- dlls/win32u/tests/win32u.c | 4 ++-- server/window.c | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index 4cc77a84a72..ed4b47925e4 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -396,9 +396,9 @@ static void test_class(void) todo_wine ok( status == STATUS_INVALID_HANDLE, "NtQueryInformationAtom returned %#lx\n", status ); ret = SetPropW( hwnd, MAKEINTRESOURCEW(0xc000), (void *)0xdeadbeef ); - todo_wine ok( ret, "SetPropW returned %lu\n", ret ); + ok( ret, "SetPropW returned %lu\n", ret ); prop = GetPropW( hwnd, MAKEINTRESOURCEW(0xc000) ); - todo_wine ok( prop == (void *)0xdeadbeef, "GetPropW returned %p\n", prop ); + ok( prop == (void *)0xdeadbeef, "GetPropW returned %p\n", prop ); prop = GetPropW( hwnd, MAKEINTRESOURCEW(0xc001) ); ok( !prop, "GetPropW returned %p\n", prop ); diff --git a/server/window.c b/server/window.c index d58f643fde9..2861b41e06b 100644 --- a/server/window.c +++ b/server/window.c @@ -493,7 +493,7 @@ static void set_property( struct window *win, atom_t atom, lparam_t data, enum p } /* need to add an entry */ - if (!grab_atom( table, atom )) return; + if (type == PROP_TYPE_STRING && !grab_atom( table, atom )) return; if (free == -1) { /* no free entry */ @@ -504,7 +504,7 @@ static void set_property( struct window *win, atom_t atom, lparam_t data, enum p sizeof(*new_props) * (win->prop_alloc + 16) ))) { set_error( STATUS_NO_MEMORY ); - release_atom( table, atom ); + if (type == PROP_TYPE_STRING) release_atom( table, atom ); return; } win->prop_alloc += 16; @@ -525,12 +525,13 @@ static lparam_t remove_property( struct window *win, atom_t atom ) for (i = 0; i < win->prop_inuse; i++) { - if (win->properties[i].type == PROP_TYPE_FREE) continue; - if (win->properties[i].atom == atom) + struct property *prop = win->properties + i; + if (prop->type == PROP_TYPE_FREE) continue; + if (prop->atom == atom) { - release_atom( table, atom ); - win->properties[i].type = PROP_TYPE_FREE; - return win->properties[i].data; + if (prop->type == PROP_TYPE_STRING) release_atom( table, atom ); + prop->type = PROP_TYPE_FREE; + return prop->data; } } /* FIXME: last error? */ @@ -560,8 +561,9 @@ static inline void destroy_properties( struct window *win ) if (!win->properties) return; for (i = 0; i < win->prop_inuse; i++) { - if (win->properties[i].type == PROP_TYPE_FREE) continue; - release_atom( table, win->properties[i].atom ); + struct property *prop = win->properties + i; + if (prop->type == PROP_TYPE_FREE) continue; + if (prop->type == PROP_TYPE_STRING) release_atom( table, prop->atom ); } free( win->properties ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10028