After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 343882 - camel_store_get_folder returns instances with refcount of two
camel_store_get_folder returns instances with refcount of two
Status: RESOLVED OBSOLETE
Product: evolution-data-server
Classification: Platform
Component: Mailer
unspecified
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2006-06-05 08:35 UTC by Philip Van Hoof
Modified: 2018-12-11 06:39 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Philip Van Hoof 2006-06-05 08:35:22 UTC
It looks like camel_store_get_folder often returns instances with a refcount of two. 

While the folder camelobject that was once asked for, using the same get_folder method on the store instance and the same folder-id, got unreferenced (for sure).

I have to unreference it in a while ref_count>=1 loop cause of this :(.

It might be a bug that I introduced myself. If that's the case, I will soon close this bug myself. I'm planning to create little test-cases and/or unit tests for this soon.

I also have to cancel the camel-operation if I want it to be fully cleared (the memory of the folder instance) while the folder is loading and I destroy the folder during that event. For example:

The folder is loading, the user decides (while loading the folder) to remove the account from the configuration. So now my code has to start destroying folder instances. This wont work for the folder being loaded (it will not freeup the memory, but the refcount will be zero -- measured with valgrind --) until I launch a forced cancellation on the operation.
Comment 1 Milan Crha 2018-12-11 06:39:33 UTC
Thanks for a bug report. This would need to retest on something more recent, like 3.30.x, because there changed many things in Camel since 2006. The ref-count on the folder can be higher in case of the store using search folders (like Trash and/or Junk), which reference the created folder when it is added to them as a subfolder. You are not supposed to unref it that many times for sure. The folder will be freed when the store is properly freed (and all other search folders which would have the got folder used as a subfolder of itself).