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

List:       kde-commits
Subject:    [qtopenal] src: Check the error conditions properly and react for
From:       Laszlo Papp <ext-laszlo.papp () nokia ! com>
Date:       2011-11-25 11:39:59
Message-ID: 20111125113959.1B24FA60B9 () git ! kde ! org
[Download RAW message or body]

Git commit fa8f6e335faf53b5249408d16041385f7e0aab1e by Laszlo Papp.
Committed on 25/11/2011 at 14:39.
Pushed by lpapp into branch 'master'.

Check the error conditions properly and react for them accodingly

M  +11   -3    src/qalcontext.cpp

http://commits.kde.org/qtopenal/fa8f6e335faf53b5249408d16041385f7e0aab1e

diff --git a/src/qalcontext.cpp b/src/qalcontext.cpp
index 682ba0f..862e031 100644
--- a/src/qalcontext.cpp
+++ b/src/qalcontext.cpp
@@ -55,8 +55,15 @@ QALContext::~QALContext()
 bool
 QALContext::create()
 {
-    if ((d->alcDevice = alcOpenDevice(d->requestedAttributes.deviceSpecifier().toAscii())) == false)
+    if ((d->alcDevice = alcOpenDevice(d->requestedAttributes.deviceSpecifier().toAscii())) == false) {
+        qWarning() << "Failed to open the device:" << d->requestedAttributes.deviceSpecifier();
         return false;
+    }
+
+    ALCenum error;
+    if ((error = alcGetError(d->alcDevice)) != ALC_NO_ERROR) {
+        qWarning() << "Error before trying to create the context:" << alcGetString(d->alcDevice, error);
+    };
 
     ALCint attributes[] = {
         ALC_FREQUENCY, d->requestedAttributes.frequency(),
@@ -67,8 +74,9 @@ QALContext::create()
         0
     };
 
-    if ((d->alcContext = alcCreateContext(d->alcDevice, attributes)) == 0)
-    {
+    d->alcContext = alcCreateContext(d->alcDevice, attributes);
+    if ((error = alcGetError(d->alcDevice)) != ALC_NO_ERROR) {
+        qWarning() << "Failed to create the context:" << alcGetString(d->alcDevice, error);
         alcCloseDevice(d->alcDevice);
         d->alcDevice = 0;
         return false;
[prev in list] [next in list] [prev in thread] [next in thread] 

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