[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pidgin-devel
Subject:    Re: Libpurple disconnecting issue
From:       Evan Schoenberg <evands () pidgin ! im>
Date:       2008-03-26 19:31:04
Message-ID: 0DE68F26-4693-4112-A2BA-A7C72014308C () pidgin ! im
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Mar 26, 2008, at 11:45 AM, Benjamin Arnaud wrote:

> I'm developping a threaded Qt windows client. I have a full thread  
> to run Libpurple in its own GLIB loop environment.
>
>
> It's running on windows I have this line in my event input add:
> #ifdef _WIN32
>
> channel = wpurple_g_io_channel_win32_new_socket(fd);
>
>
> Unfortunately it appears that when calling  
> "purple_account_disconnect" I get random crashes :
>
> the only output I have is :
>
> (client.exe:352): GLib-CRITICAL ** : g_hash_table_destroy: assertion  
> `hash_table->ref_count > 0' failed.
>
> (I get this line FOUR times).
>
> When calling "g_io_channel_unix_new" instead of  
> "wpurple_g_io_channel_win32_new_socket" the error disappears.
>
>
> Has anyone encountered the same thing ? Can it be an issue with  
> threading ? Could I contribute to solve this ?
>

libpurple should be able to run on a thread, but it is vital that you  
ensure that *all* messages to libpurple are sent on that thread, as  
libpurple is not safe for interthread interactions.  Are you managing  
the glib run loop such that it iterates on your libpurple thread?

Are you sure you really need to run libpurple and glib on a thread in  
any case?  A lot of effort has gone into ensuring that libpurple acts  
in a non-blocking fashion for networking operations and most time- 
consuming calls.

-Evan


[Attachment #5 (text/html)]

<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; "><br><div><div>On Mar 26, 2008, at 11:45 AM, \
Benjamin Arnaud wrote:</div><br class="Apple-interchange-newline"><blockquote \
type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: \
rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; \
font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: \
normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; \
white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: \
0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; \
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div><font \
face="Arial" size="2">I'm developping a threaded Qt windows client. I have a full \
thread to run Libpurple in its own GLIB loop environment.</font></div><div><font \
face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" \
size="2"></font>&nbsp;</div><div><font face="Arial" size="2">It's running on windows \
I have this line in my event input add:</font></div><div><font color="#0000ff" \
size="2"></font><p><font color="#0000ff" size="2">#ifdef</font><font size="2"><span \
class="Apple-converted-space">&nbsp;</span>_WIN32</font></p><font size="2"><p>channel \
= wpurple_g_io_channel_win32_new_socket(fd);</p><div>&nbsp;<br \
class="webkit-block-placeholder"></div><p><font face="Arial">Unfortunately it appears \
that when calling "<font size="2">purple_account_disconnect"<span \
class="Apple-converted-space">&nbsp;</span></font>I get random crashes \
:</font></p><p><font face="Arial">the only output I have is :</font></p><p><font \
face="Arial">(client.exe:352): GLib-CRITICAL ** : g_hash_table_destroy: assertion \
`hash_table-&gt;ref_count &gt; 0' failed.</font></p><p><font face="Arial">(I get this \
line FOUR times).</font></p><p><font face="Arial">When calling<span \
class="Apple-converted-space">&nbsp;</span><font color="#808080">"<font \
size="2">g_io_channel_unix_new" instead of<span \
class="Apple-converted-space">&nbsp;</span><font face="Times New \
Roman">"wpurple_g_io_channel_win32_new_socket"<span \
class="Apple-converted-space">&nbsp;</span></font>the error \
disappears.</font></font></font></p><div><font face="Arial"><font \
color="#808080"><font size="2"><font \
color="#000000"></font></font></font></font>&nbsp;<br \
class="webkit-block-placeholder"></div><p><font face="Arial"><font \
color="#808080"><font size="2"><font color="#000000">Has anyone encountered the same \
thing ? Can it be an issue with threading ? Could I contribute to solve this \
?</font></font></font></font></p></font></div></span></blockquote></div><br><div>libpurple \
should be able to run on a thread, but it is vital that you ensure that *all* \
messages to libpurple are sent on that thread, as libpurple is not safe for \
interthread interactions. &nbsp;Are you managing the glib run loop such that it \
iterates on your libpurple thread?</div><div><br \
class="webkit-block-placeholder"></div><div>Are you sure you really need to run \
libpurple and glib on a thread in any case? &nbsp;A lot of effort has gone into \
ensuring that libpurple acts in a non-blocking fashion for networking operations and \
most time-consuming calls.</div><div><br \
class="webkit-block-placeholder"></div><div>-Evan</div><div><br \
class="webkit-block-placeholder"></div></body></html>



_______________________________________________
Devel mailing list
Devel@pidgin.im
http://pidgin.im/cgi-bin/mailman/listinfo/devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic