Sharing my progress (EteSync sync backend for Akonadi, GSoC '20)

Tom Hacohen tom at stosb.com
Tue Jun 9 13:38:51 BST 2020


On 09/06/2020 10:47, Daniel Vrátil wrote:
> qPrintable(s) is just a macro that calls s.toLatin1().constData() here (so 
> basically convertintg QString to const char*, but the ownership of the data 
> pointer to by the const char* remains in the QString (or rather the QByteArray 
> temporary created by QString::toLatin1()). Anyway, this way the memory is only 
> copied during the QString->QByteArray conversion, but remains managed by the 
> QString/QByteArray, so there are no memory leaks.

What about utf8 usernames and passwords? Would those be supported, or is
there an equivalent call to do utf8 conversion?

> 
> Same then goes with the returned EteSyncCollectionInfo*, EteSyncSyncEntry* 
> etc. pointers which you mostly forget to free: for this I would suggest the 
> adaptor should never return a raw pointer unless the Etesync library remains 
> an owner of it, and wrap all pointers that you are supposed to free yourself 
> in std::unique_ptr so that you don't need to concern yourself with deleting 
> them manually.

EteSyncCollectionInfo and the likes have their own "destroy" functions,
they shouldn't be freed directly with "free".

--
Tom


More information about the kde-pim mailing list