]> Repos - portaudio/commitdiff
fixed bug in asio blocking i/o stream initialization which would cause crash (bad...
authorrossb <rossb@0f58301d-fd10-0410-b4af-bbb618454e57>
Fri, 13 Mar 2009 16:31:28 +0000 (16:31 +0000)
committerrossb <rossb@0f58301d-fd10-0410-b4af-bbb618454e57>
Fri, 13 Mar 2009 16:31:28 +0000 (16:31 +0000)
src/hostapi/asio/pa_asio.cpp

index da010f59d9da9167aad92b0de40d2a0c132aaf25..24790dd4a10d9e086e5801c7c163aadec9e83e97 100644 (file)
@@ -2055,7 +2055,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
     {
         /* Blocking i/o is implemented by running callback mode, using a special blocking i/o callback. */
         streamCallback = BlockingIoPaCallback; /* Setup PA to use the ASIO blocking i/o callback. */
-        userData       = &stream;       /* The callback user data will be the PA ASIO stream. */
+        userData       = &theAsioStream;       /* The callback user data will be the PA ASIO stream. */
         PaUtil_InitializeStreamRepresentation( &stream->streamRepresentation,
                                                &asioHostApi->blockingStreamInterface, streamCallback, userData );
     }
@@ -3470,11 +3470,8 @@ static PaError ReadStream( PaStream      *s     ,
                     /* If block processing has stopped, abort! */
                     if( blockingState->stopFlag ) { return result = paStreamIsStopped; }
 
-                    /* if a timeout is encountered, continue, perhaps we should give up eventually */
-                    continue;
-                    /* To give up eventually, we may increase the time out
-                       period and return an error if it fails anyway. */
-                    /* retrun result = paTimedOut; */
+                    /* If a timeout is encountered, give up eventually. */
+                    return result = paTimedOut;
                 }
             }
             /* Now, the ring buffer contains the required amount of data
@@ -3644,11 +3641,9 @@ static PaError WriteStream( PaStream      *s     ,
 
                     /* If block processing has stopped, abort! */
                     if( blockingState->stopFlag ) { return result = paStreamIsStopped; }
-                    /* if a timeout is encountered, continue, perhaps we should give up eventually */
-                    continue;
-                    /* To give up eventually, we may increase the time out
-                       period and return an error if it fails anyway. */
-                    /* retrun result = paTimedOut; */
+                    
+                    /* If a timeout is encountered, give up eventually. */
+                    return result = paTimedOut;
                 }
             }
             /* Now, the ring buffer contains the required amount of free