Re: Patch (work in progress): remove TnyHeader get strings methods to provide dups



We are going for this API in Tinymail, because it's the right thing to
do, so prepare your horses if you have been depending on TnyHeader's
API.

Me and Jose are reviewing the work and will be migrating this patch into
trunk today and tomorrow.


On Tue, 2008-03-25 at 11:54 +0100, Jose Dapena Paz wrote:
> 	Hi,
> 
> 	A problem we can find sometimes in Tinymail is TnyHeader is not very
> thread safe. Even when we have a single "global_lock" to protect all the
> accesses to fields of a summary, we obtain a reference to a mmapped
> string in summary, and then we leave the lock.
> 
> 	What can happen with this? We may try to access this string (a
> reference to an mmap) while in other thread we're replacing that mmap.
> And then, that pointer would be invalid and cause crashes.
> 
> 	Then, a solution is "simply" changing all the TnyHeader api (and
> TnyCamelHeader and Camel backends) to copy the strings instead of
> obtaining references. This way we can do the copy inside the protection
> of the global_lock in camel-folder-summary.c.
> 
> 	I added a patch implementing this. This is a work in progress, so it
> won't surely work in some platforms, the vala changes are probably
> wrong, etc, etc. But it's the idea for discussion.
> 
> 	The patch removes all tny_header_get_ methods that obtained static
> strings, and now you have tny_header_dup_ methods for this (that's for
> making compilation fail easily if you don't move to the new api).
> 
> _______________________________________________
> tinymail-devel-list mailing list
> tinymail-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/tinymail-devel-list
-- 
Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
http://pvanhoof.be/blog
http://codeminded.be






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]