From 4522c54a131a0eebbe2b70b6ae1cd72bf6e6e62d Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Mon, 7 Jun 2021 16:28:57 +1000 Subject: [PATCH] msado15: Correct field reference value. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/msado15/recordset.c | 9 +++++++++ dlls/msado15/tests/msado15.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c index 2b32dc6cf94..8d7619d9161 100644 --- a/dlls/msado15/recordset.c +++ b/dlls/msado15/recordset.c @@ -594,6 +594,7 @@ static HRESULT Field_create( const WCHAR *name, LONG index, struct recordset *re field->Field_iface.lpVtbl = &field_vtbl; field->ISupportErrorInfo_iface.lpVtbl = &field_supporterrorinfo_vtbl; field->Properties_iface.lpVtbl = &field_properties_vtbl; + field->refs = 1; if (!(field->name = strdupW( name ))) { heap_free( field ); @@ -998,6 +999,7 @@ static ULONG WINAPI recordset_AddRef( _Recordset *iface ) static void close_recordset( struct recordset *recordset ) { ULONG row, col, col_count; + ULONG i; if ( recordset->row_set ) IRowset_Release( recordset->row_set ); recordset->row_set = NULL; @@ -1005,6 +1007,13 @@ static void close_recordset( struct recordset *recordset ) if (!recordset->fields) return; col_count = get_column_count( recordset ); + for (i = 0; i < col_count; i++) + { + struct field *field = impl_from_Field( recordset->fields->field[i] ); + field->recordset = NULL; + Field_Release(&field->Field_iface); + } + recordset->fields->count = 0; Fields_Release( &recordset->fields->Fields_iface ); recordset->fields = NULL; diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c index 16faefef550..97a578b0618 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -273,7 +273,7 @@ static void test_Recordset(void) count = -1; hr = Fields_get_Count( fields, &count ); - todo_wine ok( !count, "got %d\n", count ); + ok( !count, "got %d\n", count ); hr = Field_get_Name(field, &name); todo_wine ok( hr == MAKE_ADO_HRESULT( adErrObjectNotSet ), "got %08x\n", hr );