Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-12-05 03:50:55 +0300
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-12-05 03:50:55 +0300
commit5d04d876f724626c36e5feba2dd6c16a3049243b (patch)
tree323aa3eb1713a1d1c57d357d0472c022f4904aae /intern
parentaad31875d7224c58b1d94bd716bb5aab295fc8cb (diff)
Fix for bug #1875:
OpenAL (pthreads) was generating a SIGHUP at alcDestroyContext(). Fix by setting SIGHUP to ignore.
Diffstat (limited to 'intern')
-rw-r--r--intern/SoundSystem/openal/SND_OpenALDevice.cpp47
-rw-r--r--intern/SoundSystem/openal/SND_OpenALDevice.h2
2 files changed, 40 insertions, 9 deletions
diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.cpp b/intern/SoundSystem/openal/SND_OpenALDevice.cpp
index 6eea000559d..a7f7b075efa 100644
--- a/intern/SoundSystem/openal/SND_OpenALDevice.cpp
+++ b/intern/SoundSystem/openal/SND_OpenALDevice.cpp
@@ -60,6 +60,8 @@
#endif
#include <fcntl.h>
+#include <signal.h>
+
/* untill openal gets unified we need this hack for non-windows systems */
#if !defined(WIN32) && !defined(ALC_MAJOR_VERSION)
@@ -208,7 +210,8 @@ ALvoid alutUnloadWAV(ALenum format,ALvoid *data,ALsizei size,ALsizei freq)
SND_OpenALDevice::SND_OpenALDevice()
- : m_context(NULL),
+ : SND_AudioDevice(),
+ m_context(NULL),
m_device(NULL)
{
/* Removed the functionality for checking if noaudio was provided on */
@@ -235,6 +238,20 @@ SND_OpenALDevice::SND_OpenALDevice()
alcMakeContextCurrent(m_context);
m_audio = true;
m_device = dev;
+#ifdef __linux__
+ /*
+ * SIGHUP Hack:
+ *
+ * On Linux, alcDestroyContext generates a SIGHUP (Hangup) when killing the OpenAL
+ * mixer thread, which kills Blender.
+ *
+ * So we set the signal to ignore....
+ *
+ * TODO: check if this applies to other platforms.
+ *
+ */
+ signal(SIGHUP, SIG_IGN);
+#endif
}
}
@@ -307,19 +324,33 @@ void SND_OpenALDevice::MakeCurrent() const
SND_OpenALDevice::~SND_OpenALDevice()
{
+ MakeCurrent();
+
+ if (m_buffersinitialized)
+ {
+ alDeleteBuffers(NUM_BUFFERS, m_buffers);
+ m_buffersinitialized = false;
+ }
+
+ if (m_sourcesinitialized)
+ {
+ for (int i = 0; i < NUM_SOURCES; i++)
+ alSourceStop(m_sources[i]);
+
+ alDeleteSources(NUM_SOURCES, m_sources);
+ m_sourcesinitialized = false;
+ }
+
if (m_context) {
MakeCurrent();
-
- if (m_buffersinitialized)
- alDeleteBuffers(NUM_BUFFERS, m_buffers);
-
- if (m_sourcesinitialized)
- alDeleteSources(NUM_SOURCES, m_sources);
-
alcDestroyContext(m_context);
m_context = NULL;
}
+#ifdef __linux__
+ // restore the signal state above.
+ signal(SIGHUP, SIG_DFL);
+#endif
// let's see if we used the cd. if not, just leave it alone
SND_CDObject* pCD = SND_CDObject::Instance();
diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.h b/intern/SoundSystem/openal/SND_OpenALDevice.h
index 4cd386cd48d..e54c0443462 100644
--- a/intern/SoundSystem/openal/SND_OpenALDevice.h
+++ b/intern/SoundSystem/openal/SND_OpenALDevice.h
@@ -41,7 +41,7 @@ class SND_OpenALDevice : public SND_AudioDevice
{
public:
SND_OpenALDevice();
- ~SND_OpenALDevice();
+ virtual ~SND_OpenALDevice();
SND_WaveSlot* LoadSample(const STR_String& samplename,
void* memlocation,