Bug #646268: Fix missing GWEN_SYNCIO initialization.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20565 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2011-04-19 08:05:04 +00:00
parent 22ddb018de
commit 2972057868

View File

@ -76,7 +76,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
GWEN_DB_NODE *db_profiles = NULL; GWEN_DB_NODE *db_profiles = NULL;
GWEN_DB_NODE *db_profile; GWEN_DB_NODE *db_profile;
AB_IMEXPORTER_CONTEXT *context = NULL; AB_IMEXPORTER_CONTEXT *context = NULL;
GWEN_IO_LAYER *io; GWEN_IO_LAYER *io = NULL;
GncABImExContextImport *ieci = NULL; GncABImExContextImport *ieci = NULL;
AB_JOB_LIST2 *job_list = NULL; AB_JOB_LIST2 *job_list = NULL;
AB_JOB_LIST2_ITERATOR *jit; AB_JOB_LIST2_ITERATOR *jit;
@ -177,8 +177,22 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
#ifdef AQBANKING_VERSION_5_PLUS #ifdef AQBANKING_VERSION_5_PLUS
close(dtaus_fd); close(dtaus_fd);
io = GWEN_SyncIo_File_new(selected_filename, GWEN_SyncIo_File_CreationMode_OpenExisting); io = GWEN_SyncIo_File_new(selected_filename, GWEN_SyncIo_File_CreationMode_OpenExisting);
g_assert(io);
GWEN_SyncIo_AddFlags(io, GWEN_SYNCIO_FILE_FLAGS_READ);
{
/* We must explicitly call "Connect" on the GWEN_SYNCIO
* object. */
int rv = GWEN_SyncIo_Connect(io);
if (rv < 0)
{
g_warning("gnc_file_aqbanking_import: Failed to open file %s: %d", selected_filename, rv);
goto cleanup;
}
g_assert(GWEN_SyncIo_GetStatus == GWEN_SyncIo_Status_Connected);
}
#else #else
io = GWEN_Io_LayerFile_new(dtaus_fd, -1); io = GWEN_Io_LayerFile_new(dtaus_fd, -1);
g_assert(io);
if (GWEN_Io_Manager_RegisterLayer(io)) if (GWEN_Io_Manager_RegisterLayer(io))
{ {
g_warning("gnc_file_aqbanking_import: Failed to wrap file"); g_warning("gnc_file_aqbanking_import: Failed to wrap file");
@ -204,6 +218,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
#else #else
GWEN_Io_Layer_free(io); GWEN_Io_Layer_free(io);
#endif #endif
io = NULL;
/* Import the results */ /* Import the results */
ieci = gnc_ab_import_context(context, AWAIT_TRANSACTIONS, ieci = gnc_ab_import_context(context, AWAIT_TRANSACTIONS,
@ -322,6 +337,15 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
} }
cleanup: cleanup:
if (io)
{
#ifdef AQBANKING_VERSION_5_PLUS
GWEN_SyncIo_free(io);
#else
GWEN_Io_Layer_free(io);
#endif
}
if (job_list) if (job_list)
AB_Job_List2_FreeAll(job_list); AB_Job_List2_FreeAll(job_list);
if (ieci) if (ieci)