Hopefully I fixed the attachments.

On Wed, May 26, 2010 at 11:34 PM, Justin Browne <[email protected]> wrote:

> Hi,
>
> I realized that in Xmms::MainLoop::waitForData() the listener was not being
> removed from the listener list after it was handled because my program was
> hanging at line 96 of mainloop.cpp.
>
> I applied the first patch (attached), and it solved my problem, but then
> thought it would be better if I applied the second patch (also attached).
> However, after applying the second patch, it never called handleIn(),
> defeating the purpose of the patch.
>
> The first patch might actually be correct, but I have a feeling it is not.
> I will leave that for someone more familiar with this.
>
> - Justin Browne
diff --git a/src/clients/lib/xmmsclient++/mainloop.cpp 
b/src/clients/lib/xmmsclient++/mainloop.cpp
index a6fd8a0..dba1720 100644
--- a/src/clients/lib/xmmsclient++/mainloop.cpp
+++ b/src/clients/lib/xmmsclient++/mainloop.cpp
@@ -113,6 +113,7 @@ namespace Xmms
                                if( (*lit)->listenIn()
                                        && 
FD_ISSET((*lit)->getFileDescriptor(), &rfds) ) {
                                        (*lit)->handleIn();
+                                       removeListener (*lit);
                                }
 
                        }
diff --git a/src/clients/lib/xmmsclient++/mainloop.cpp 
b/src/clients/lib/xmmsclient++/mainloop.cpp
index a6fd8a0..d019030 100644
--- a/src/clients/lib/xmmsclient++/mainloop.cpp
+++ b/src/clients/lib/xmmsclient++/mainloop.cpp
@@ -105,16 +105,23 @@ namespace Xmms
                            lit != listeners.end() && listeners.size() != 0;
                            ++lit) {
 
+                               bool remove = false;
+
                                if( (*lit)->listenOut()
                                        && 
FD_ISSET((*lit)->getFileDescriptor(), &wfds) ) {
                                        (*lit)->handleOut();
+                                       remove = true;
                                }
 
                                if( (*lit)->listenIn()
                                        && 
FD_ISSET((*lit)->getFileDescriptor(), &rfds) ) {
                                        (*lit)->handleIn();
+                                       remove = true;
                                }
 
+                               if (remove) {
+                                       removeListener (*lit);
+                               }
                        }
                }
        }
--
_______________________________________________
Xmms2-devel mailing list
[email protected]
http://lists.xmms.se/cgi-bin/mailman/listinfo/xmms2-devel

Reply via email to