diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2013-02-27 06:46:17 -0800 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2013-03-04 07:36:21 -0800 |
commit | e96ff22fdd809dc44c0a38780a50d3cf05cabb24 (patch) | |
tree | 7da7af2ec36b34d51d5fffcebd970a7017c156cd /src | |
parent | e05454d56334eef225fbff02f382adf9cbdc30fd (diff) |
ActiveSync: avoid explicit g_object_unref for EasSyncHandler
Better use a smart pointer - less code and harder to make mistakes.
Diffstat (limited to 'src')
-rw-r--r-- | src/backends/activesync/ActiveSyncSource.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backends/activesync/ActiveSyncSource.cpp b/src/backends/activesync/ActiveSyncSource.cpp index f6fc3f46..9fa67bfd 100644 --- a/src/backends/activesync/ActiveSyncSource.cpp +++ b/src/backends/activesync/ActiveSyncSource.cpp @@ -34,6 +34,8 @@ #include <boost/algorithm/string.hpp> #include <boost/range/adaptors.hpp> +SE_GOBJECT_TYPE(EasSyncHandler) + /* #include <eas-connection-errors.h> */ #include <syncevo/declarations.h> SE_BEGIN_CXX @@ -69,7 +71,7 @@ std::string ActiveSyncSource::Collection::fullPath() { void ActiveSyncSource::findCollections(const std::string account, const bool force_update) { GErrorCXX gerror; - EasSyncHandler *handler; + EasSyncHandlerCXX handler; EASFoldersCXX folders; if (!m_collections.empty()) { @@ -79,7 +81,7 @@ void ActiveSyncSource::findCollections(const std::string account, const bool for } /* Fetch the folders */ - handler = eas_sync_handler_new(account.c_str()); + handler = EasSyncHandlerCXX::steal(eas_sync_handler_new(account.c_str())); if (!handler) throwError("findCollections cannot allocate sync handler"); if (!eas_sync_handler_get_folder_list (handler, @@ -87,10 +89,8 @@ void ActiveSyncSource::findCollections(const std::string account, const bool for folders, NULL, gerror)) { - g_object_unref(handler); gerror.throwError("fetching folder list"); } - g_object_unref(handler); /* Save the Collections */ BOOST_FOREACH(EasFolder *folder, folders) { |