Changeset 20872

Show
Ignore:
Timestamp:
09/26/07 14:54:35 (1 year ago)
Author:
patrick
Message:

Fixed nasty crash-on-exit problems caused by Sonix cleaning up the resources
in Audiere or OpenAL at the wrong time. As near as I can tell, Audiere and
OpenAL clean-up procedures need to occur in the same thread where they were
initialized. In order for this to happen, we have to be able to tell the
Sound Manager (and Sonix) to shut down at the appropriate time. Having it
happen as a side effect of the snx::sonix singleton being destroyed at the
time of application exit caused the crashes.

Bumped the version to 2.3.15.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/vrjuggler/ChangeLog

    r20824 r20872  
    11DATE        AUTHOR      CHANGE 
    22----------- ----------- ------------------------------------------------------- 
     3Sep-26-2007 patrick     Fixed crash-on-exit problems with Sonix. 
     4                        NEW VERSION: 2.3.15 
    35Sep-19-2007 patrick     Added draw thread CPU affinity capabilities through the 
    46                        new environment variable VJ_DRAW_THREAD_AFFINITY. This 
  • juggler/trunk/modules/vrjuggler/VERSION

    r20824 r20872  
     12.3.15-0 @09/26/2007 19:55:00 UTC@ 
    122.3.14-0 @09/19/2007 19:10:00 UTC@ 
    232.3.13-0 @09/05/2007 02:05:00 UTC@ 
  • juggler/trunk/modules/vrjuggler/configure.ac

    r20792 r20872  
    178178GADGETEER_PATH([1.3.7], , 
    179179               [AC_MSG_ERROR(*** Gadgeteer required for VR Juggler ***)]) 
    180 SNX_PATH([1.1.4], , [AC_MSG_ERROR(*** Sonix required for VR Juggler ***)]) 
     180SNX_PATH([1.3.6], , [AC_MSG_ERROR(*** Sonix required for VR Juggler ***)]) 
    181181 
    182182VJ_GET_BOOST_LIB_SUFFIX_LIST([$dpp_boost_major], [$dpp_boost_minor], 
  • juggler/trunk/modules/vrjuggler/vrj/Kernel/Kernel.cpp

    r20606 r20872  
    700700   // XXX: TODO: Free resources (ie closeContext()) 
    701701 
    702    // If the new application is NULL OR 
    703    // we have an old draw manager and it is different from the new one, stop it. 
    704    if (NULL == newApp || NULL != mDrawManager && newApp->getDrawManager() != mDrawManager) 
     702   // If the new application is NULL OR we have an old Draw Manager that is 
     703   // different from the new one, then stop the current Draw Manager. 
     704   if ( NULL == newApp || NULL != mDrawManager && 
     705        newApp->getDrawManager() != mDrawManager ) 
    705706   { 
    706707      stopDrawManager(); 
    707708      cfg_mgr->removeConfigElementHandler(mDrawManager); 
     709   } 
     710 
     711   // If the new application is NULL OR we have an old Sound Manager that is 
     712   // different from the new one, then stop the current Sound Manager. 
     713   if ( NULL == newApp || NULL != mSoundManager && 
     714        newApp->getSoundManager() != mSoundManager ) 
     715   { 
     716      stopSoundManager(); 
    708717      cfg_mgr->removeConfigElementHandler(mSoundManager); 
    709718   } 
     
    731740 
    732741         mDrawManager = mApp->getDrawManager();             // Get the new draw manager 
    733          mSoundManager = mApp->getSoundManager();           // Get the new sound manager 
    734742         cfg_mgr->addConfigElementHandler(mDrawManager);    // Tell config manager about them 
    735          cfg_mgr->addConfigElementHandler(mSoundManager);   // Tell config manager about them 
    736743         startDrawManager(true);                      // Start the new one 
    737744      } 
     
    740747         startDrawManager(false);                     // Start new app 
    741748      } 
     749 
     750      if ( mApp->getSoundManager() != mSoundManager ) 
     751      { 
     752         // Get the new sound manager and tell the Config Manager about it. 
     753         mSoundManager = mApp->getSoundManager(); 
     754         cfg_mgr->addConfigElementHandler(mSoundManager); 
     755      } 
     756 
    742757      // Now handle configuration 
    743758      cfg_mgr->addConfigElementHandler(mApp); 
     
    977992      mDrawManager = NULL; 
    978993      mDisplayManager->setDrawManager(NULL); 
     994   } 
     995} 
     996 
     997void Kernel::stopSoundManager() 
     998{ 
     999   if ( NULL != mSoundManager ) 
     1000   { 
     1001      mSoundManager->closeAPI(); 
     1002      mSoundManager = NULL; 
    9791003   } 
    9801004} 
  • juggler/trunk/modules/vrjuggler/vrj/Kernel/Kernel.h

    r20176 r20872  
    397397   //@} 
    398398 
     399   /** @name Sound Manager Routines */ 
     400   //@{ 
     401   /** 
     402    * Stops the Sound Manager and closes its resources. 
     403    * 
     404    * @post \c mSoundManager is NULL. 
     405    * 
     406    * @since 2.3.15 
     407    */ 
     408   void stopSoundManager(); 
     409   //@} 
     410 
    399411public: 
    400412   /** @name Global "get" interface */ 
  • juggler/trunk/modules/vrjuggler/vrj/Sound/SoundManager.h

    r19729 r20872  
    8282       */ 
    8383      virtual void sync() {} 
     84 
     85      /** 
     86       * Shuts down the sound API currently in use. 
     87       * 
     88       * @since 2.3.15 
     89       */ 
     90      virtual void closeAPI() {} 
    8491   }; 
    8592} // end namespace 
  • juggler/trunk/modules/vrjuggler/vrj/Sound/SoundManagerSonix.cpp

    r19729 r20872  
    212212   } 
    213213 
     214   void SoundManagerSonix::closeAPI() 
     215   { 
     216      snx::sonix::instance()->shutdownAPI(); 
     217   } 
     218 
    214219} // end namespace 
  • juggler/trunk/modules/vrjuggler/vrj/Sound/SoundManagerSonix.h

    r19729 r20872  
    7171      virtual void sync(); 
    7272 
     73      /** 
     74       * Tells Sonix to shut down the current sound API. Depending on what 
     75       * sound API is in use, this will cause sounds to stop playing and 
     76       * loaded resources to be released. 
     77       * 
     78       * @since 2.3.15 
     79       */ 
     80      virtual void closeAPI(); 
     81 
    7382   private: 
    7483      vpr::Interval mLastFrameTime;