From 642106b425d871016cf5797ed379c65430388d1c Mon Sep 17 00:00:00 2001 From: Ingo Huerner Date: Thu, 14 Nov 2013 17:23:55 +0100 Subject: [PATCH] Fixed a problem with change callback registration --- include/persistence_client_library_file.h | 2 +- src/persistence_client_library_db_access.c | 2 +- src/persistence_client_library_dbus_service.c | 11 ++++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/persistence_client_library_file.h b/include/persistence_client_library_file.h index 0df35c4..5f26eef 100644 --- a/include/persistence_client_library_file.h +++ b/include/persistence_client_library_file.h @@ -184,7 +184,7 @@ int pclFileWriteData(int fd, const void * buffer, int buffer_size); * @param path the path to the file * @param size the size of the path * - * @note the allocated memory for the path string will be freed in tpclFileReleasePath + * @note the allocated memory for the path string will be freed in pclFileReleasePath * * @return positive value on success, which must be used when pclFileReleasePath will be called * On error a negative value will be returned with th follwoing error codes: diff --git a/src/persistence_client_library_db_access.c b/src/persistence_client_library_db_access.c index 2f6aec7..9932548 100644 --- a/src/persistence_client_library_db_access.c +++ b/src/persistence_client_library_db_access.c @@ -616,7 +616,7 @@ int persistence_notify_on_change(char* key, unsigned int ldbid, unsigned int use gRegNotifySeatNo = seat_no; gRegNotifyPolicy = regPolicy; - if(regPolicy == Notify_lastEntry) + if(regPolicy == Notify_register) { // assign callback gChangeNotifyCallback = callback; diff --git a/src/persistence_client_library_dbus_service.c b/src/persistence_client_library_dbus_service.c index deaa397..aade4d3 100644 --- a/src/persistence_client_library_dbus_service.c +++ b/src/persistence_client_library_dbus_service.c @@ -161,8 +161,14 @@ static DBusHandlerResult handleObjectPathMessageFallback(DBusConnection * connec notifyStruct.seat_no = atoi(seat_no); // call the registered callback function - gChangeNotifyCallback(¬ifyStruct); - + if(gChangeNotifyCallback != NULL ) + { + gChangeNotifyCallback(¬ifyStruct); + } + else + { + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("handleObjectPathMessageFallback => gChangeNotifyCallback is not set (possibly NULL)") ); + } result = DBUS_HANDLER_RESULT_HANDLED; } dbus_connection_flush(connection); @@ -205,7 +211,6 @@ static DBusHandlerResult handleObjectPathMessageFallback(DBusConnection * connec DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("handleObjectPathMessageFallback -> not a signal:"), DLT_STRING(dbus_message_get_member(message)) ); } } - return result; } -- 2.7.4