summaryrefslogtreecommitdiff
path: root/libs/pbd/crossthread.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-12-09 18:37:06 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-12-09 18:37:06 +0000
commitb8b55ef0036bbef9a2961f03f44387ea8c89456a (patch)
tree47bead791023bd5efab6306ebcfea101f48688a7 /libs/pbd/crossthread.cc
parentc38e02285fda1fd7966c9e4ad85994445247e6a6 (diff)
OSC is now driven by an event loop; fix up lifetime mgmt of Glib::Source to workaround bug in Glib
git-svn-id: svn://localhost/ardour2/branches/3.0@6329 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/crossthread.cc')
-rw-r--r--libs/pbd/crossthread.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/libs/pbd/crossthread.cc b/libs/pbd/crossthread.cc
index 1465505b56..2bcb444b36 100644
--- a/libs/pbd/crossthread.cc
+++ b/libs/pbd/crossthread.cc
@@ -32,6 +32,7 @@ using namespace Glib;
CrossThreadChannel::CrossThreadChannel ()
{
+ _ios = 0;
fds[0] = -1;
fds[1] = -1;
@@ -49,12 +50,12 @@ CrossThreadChannel::CrossThreadChannel ()
error << "cannot set non-blocking mode for x-thread pipe (write) (%2)" << ::strerror (errno) << ')' << endmsg;
return;
}
-
}
CrossThreadChannel::~CrossThreadChannel ()
{
- _ios->destroy ();
+ /* glibmm hack */
+ drop_ios ();
if (fds[0] >= 0) {
close (fds[0]);
@@ -78,11 +79,18 @@ RefPtr<IOSource>
CrossThreadChannel::ios ()
{
if (!_ios) {
- _ios = IOSource::create (fds[0], IOCondition(IO_IN|IO_PRI|IO_ERR|IO_HUP|IO_NVAL));
+ _ios = new RefPtr<IOSource> (IOSource::create (fds[0], IOCondition(IO_IN|IO_PRI|IO_ERR|IO_HUP|IO_NVAL)));
}
- return _ios;
+ return *_ios;
+}
+
+void
+CrossThreadChannel::drop_ios ()
+{
+ delete _ios;
+ _ios = 0;
}
-
+
void
CrossThreadChannel::drain ()
{