[vlc-devel] commit: skins2: work around a deallocation problem (Erwan Tulou )
git version control
git at videolan.org
Mon Feb 22 17:29:10 CET 2010
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Mon Feb 22 17:03:44 2010 +0100| [e95b99e6466cf4a9d1c9c27bc980b0dc11c5092f] | committer: Erwan Tulou
skins2: work around a deallocation problem
VlcManager and VarManager dependents on each other (a design problem)
Anyway, it is a bad idea to use instance() on any manager when deallocating ressources
as it can start anew a manager already deallocated.
Better use global variables in p_sys and act accordingly.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e95b99e6466cf4a9d1c9c27bc980b0dc11c5092f
---
modules/gui/skins2/utils/var_text.cpp | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/modules/gui/skins2/utils/var_text.cpp b/modules/gui/skins2/utils/var_text.cpp
index e692433..4ca805f 100644
--- a/modules/gui/skins2/utils/var_text.cpp
+++ b/modules/gui/skins2/utils/var_text.cpp
@@ -219,14 +219,21 @@ void VarText::onUpdate( Subject<VarText> &rVariable, void *arg )
void VarText::delObservers()
{
// Stop observing other variables
- VlcProc *pVlcProc = VlcProc::instance( getIntf() );
- pVlcProc->getTimeVar().delObserver( this );
- pVlcProc->getVolumeVar().delObserver( this );
- pVlcProc->getStreamNameVar().delObserver( this );
- pVlcProc->getStreamURIVar().delObserver( this );
- pVlcProc->getStreamBitRateVar().delObserver( this );
- pVlcProc->getStreamSampleRateVar().delObserver( this );
- VarManager *pVarManager = VarManager::instance( getIntf() );
- pVarManager->getHelpText().delObserver( this );
+
+ VlcProc *pVlcProc = getIntf()->p_sys->p_vlcProc;
+ VarManager *pVarManager = getIntf()->p_sys->p_varManager;
+
+ if( pVlcProc )
+ {
+ pVlcProc->getTimeVar().delObserver( this );
+ pVlcProc->getVolumeVar().delObserver( this );
+ pVlcProc->getStreamNameVar().delObserver( this );
+ pVlcProc->getStreamURIVar().delObserver( this );
+ pVlcProc->getStreamBitRateVar().delObserver( this );
+ pVlcProc->getStreamSampleRateVar().delObserver( this );
+ }
+
+ if( pVarManager )
+ pVarManager->getHelpText().delObserver( this );
}
More information about the vlc-devel
mailing list