[PATCH 3/3] msado15: Correct field reference value
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Mon Jun 7 01:28:57 CDT 2021
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
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 );
--
2.30.2
More information about the wine-devel
mailing list