From caa225a496ce6875ea3c447964915a1b6b82751a Mon Sep 17 00:00:00 2001 From: winesync Date: Sun, 13 Mar 2022 19:08:41 +0100 Subject: [PATCH] [WINESYNC] msi: Fix table ref count on create. Signed-off-by: Piotr Caban Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard wine commit id 405486fbe6853c78744099fa1ebe07995e07a438 by Piotr Caban --- dll/win32/msi/create.c | 2 +- dll/win32/msi/query.h | 2 +- dll/win32/msi/table.c | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dll/win32/msi/create.c b/dll/win32/msi/create.c index 6133159dce6..94c62ec5733 100644 --- a/dll/win32/msi/create.c +++ b/dll/win32/msi/create.c @@ -68,7 +68,7 @@ static UINT CREATE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) if (cv->bIsTemp && !cv->hold) return ERROR_SUCCESS; - return msi_create_table( cv->db, cv->name, cv->col_info, persist ); + return msi_create_table( cv->db, cv->name, cv->col_info, persist, cv->hold ); } static UINT CREATE_close( struct tagMSIVIEW *view ) diff --git a/dll/win32/msi/query.h b/dll/win32/msi/query.h index c0144d30544..5e5f3906f4f 100644 --- a/dll/win32/msi/query.h +++ b/dll/win32/msi/query.h @@ -149,7 +149,7 @@ int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip) DECLSPEC_HIDDEN; MSIRECORD *msi_query_merge_record( UINT fields, const column_info *vl, MSIRECORD *rec ) DECLSPEC_HIDDEN; UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, - MSICONDITION persistent ) DECLSPEC_HIDDEN; + MSICONDITION persistent, BOOL hold ) DECLSPEC_HIDDEN; UINT msi_select_update( MSIVIEW *view, MSIRECORD *rec, UINT row ) DECLSPEC_HIDDEN; diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index db4dd59f958..7fae4ad07ae 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -713,7 +713,7 @@ static UINT get_tablecolumns( MSIDATABASE *db, LPCWSTR szTableName, MSICOLUMNINF } UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, - MSICONDITION persistent ) + MSICONDITION persistent, BOOL hold ) { UINT r, nField; MSIVIEW *tv = NULL; @@ -733,7 +733,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, if( !table ) return ERROR_FUNCTION_FAILED; - table->ref_count = 1; + table->ref_count = 0; table->row_count = 0; table->data = NULL; table->data_persistent = NULL; @@ -742,6 +742,9 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, table->persistent = persistent; lstrcpyW( table->name, name ); + if( hold ) + table->ref_count++; + for( col = col_info; col; col = col->next ) table->col_count++;