Multi-threaded access to "purple_normalize" issue ?

Mauro Sérgio Ferreira Brasil mauro.brasil at tqi.com.br
Tue Jan 15 14:52:29 EST 2008


Hello there!

I work with an application that uses libpurple as infrastructure for IM 
services, and very rarely I'm questioned by our customer about problems 
their client have while sending messages.
They claim that sometimes they send a message to one person but it goes 
to a different one.

Considering that our client's application work with two different 
threads (application UI thread, and libpurple - or glib - one), we are 
facing a very difficult problem to track here.

All access to libpurple is already being "sincronized" (through 
"purple_timeout_add" and other methods), but we put only the final 
methods like "purple_account_set_status", "purple_conv_im_send", etc, 
inside the "serialized" scope. While lots of libpurple methods  like 
"purple_conversation_new", "purple_utf8_try_convert", 
"purple_normalize", etc, are accessed outside the "serialized" scope.

After the first analysis, we found one method that is making us a little 
bit worried considering the multi-thread scenario we have here, that is 
"purple_normalize". This method documentation states that the returning 
value is a pointer to a static variable and should not be stored for 
long-term usage. But, the question is: Could it be stored at all ?

In most of places the result of this method is automatically duplicated 
(through "g_strdup" method), or used immediately on a comparing method, 
but is still there methods that stores the returned value on variables 
to short or very short term usage.
Inside the MSN protocol implementation, the result of method 
"msn_normalize" being stored for further use is even more common.

Considering our situation here, of multiple threads accessing the 
libpurple API while using this method, does any one know whether this 
could lead to problems ?

Thank's and best regards,

-- 
__At.,                                                                                                                             
   _
 
*Technology and Quality on Information*
Mauro Sérgio Ferreira Brasil
Coordenador de Projetos e Analista de Sistemas
+ mauro.brasil at tqi.com.br <mailto:@tqi.com.br>
: www.tqi.com.br <http://www.tqi.com.br>
( + 55 (34)3291-1700
( + 55 (34)9971-2572

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.im/pipermail/devel/attachments/20080115/d1392e29/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMMI_2.jpg
Type: image/jpeg
Size: 1705 bytes
Desc: not available
URL: <http://pidgin.im/pipermail/devel/attachments/20080115/d1392e29/attachment-0002.jpg>


More information about the Devel mailing list