[ruamoko] Fix incorrect clearing of dtables

The problem was caused by passing the index into the dtables array to
dtable_get which expects a handle. A handle is the ones-compliment
negative of the index which means that handle 0 is invalid (but 0 was
being passed... oops). Fixes the segfault when qw-client-x11 connects to
a server.
This commit is contained in:
Bill Currie 2020-08-17 11:30:53 +09:00
parent 3413947e0c
commit 62c20aa4ab

View file

@ -2192,7 +2192,10 @@ rua_obj_cleanup (progs_t *pr, void *data)
}
for (i = 0; i < probj->dtables._size; i++) {
dtable_t *dtable = dtable_get (probj, i);
/* dtable_get expects a handle, but a handle is the ones-compliment
* negative of the index.
*/
dtable_t *dtable = dtable_get (probj, ~i);
if (!dtable->imp) {
break;
}