[Helix-client-dev] CR-Client: fixes (HEAD only) crash due to vidsite.dll getting unloaded early
Erik Hodge ehodge at real.com========
Synopsis
========
This change fixes a crash that happened when vidsite.dll
was erroneously getting unloaded early by the plugin
handler.
=========
Branches:
=========
HEAD
===========
Description
===========
At about 40 seconds into playback, a timer causes
hxmedpltfm.dll's Plugin2Handler::UnloadDeadDLLs()
to get called to get the plugin2Handler to see if
there are any DLLs that are loaded that have a
zero use count. If it finds any, it unloads each.
Before the proposed changes in the below diff,
vidsite.dll's base counting object's m_lNumObjects
was 0 when this happened and it thus got unloaded
at around 40 seconds. This caused a crash
accessing a no-longer-valid memory space whenever
any site user tried to do anything with a site
thereafter.
Solution here is to have all classes that
implement an interface in video/sitelib inherit
from CHXBaseCountingObject. That way, the base
counting object's count goes up for users of those
vidsite.dll objects (IHXSite, ...etc.)
===============
Files modified:
===============
/cvsroot/video/sitelib/sitetext.h
/cvsroot/video/sitelib/platform/mac/macroot.cpp
/cvsroot/video/sitelib/platform/mac/macsite.cpp
/cvsroot/video/sitelib/platform/mac/macsurf.cpp
/cvsroot/video/sitelib/platform/mac/sitetext.cpp
/cvsroot/video/sitelib/platform/unix/sitetext.cpp
/cvsroot/video/sitelib/platform/win/sitetext.cpp
/cvsroot/video/sitelib/pub/baseroot.h
/cvsroot/video/sitelib/pub/basesite.h
/cvsroot/video/sitelib/pub/basesurf.h
/cvsroot/video/sitelib/pub/surface.h
/cvsroot/video/sitelib/pub/vidsurf2.h
=========
The diff:
=========
Index: sitetext.h
===================================================================
RCS file: /cvsroot/video/sitelib/sitetext.h,v
retrieving revision 1.5
diff -u -r1.5 sitetext.h
--- sitetext.h 11 Mar 2005 19:58:06 -0000 1.5
+++ sitetext.h 5 Apr 2006 17:15:49 -0000
@@ -50,11 +50,13 @@
#ifndef _SITETEXT_H_
#define _SITETEXT_H_
+#include "baseobj.h"
#if !defined(_WINDOWS)
class CHXSiteStatusText : public IHXSiteUser
+ , public CHXBaseCountingObject
#else
-class CHXSiteStatusText
+class CHXSiteStatusText : public CHXBaseCountingObject
#endif
{
public:
Index: platform/mac/macroot.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/mac/macroot.cpp,v
retrieving revision 1.15
diff -u -r1.15 macroot.cpp
--- platform/mac/macroot.cpp 23 Feb 2006 18:31:16 -0000 1.15
+++ platform/mac/macroot.cpp 5 Apr 2006 17:15:49 -0000
@@ -60,6 +60,7 @@
#include "chxxtype.h"
#include "hxvctrl.h"
#include "hxvsurf.h"
+#include "baseobj.h"
#include "surface.h"
#include "vidosurf.h"
#include "sitetext.h"
Index: platform/mac/macsite.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/mac/macsite.cpp,v
retrieving revision 1.21
diff -u -r1.21 macsite.cpp
--- platform/mac/macsite.cpp 16 Nov 2005 23:49:12 -0000 1.21
+++ platform/mac/macsite.cpp 5 Apr 2006 17:15:49 -0000
@@ -66,6 +66,7 @@
#include "chxxtype.h"
#include "hxvctrl.h"
#include "hxvsurf.h"
+#include "baseobj.h"
#include "surface.h"
#include "vidosurf.h"
#include "sitetext.h"
Index: platform/mac/macsurf.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/mac/macsurf.cpp,v
retrieving revision 1.20
diff -u -r1.20 macsurf.cpp
--- platform/mac/macsurf.cpp 16 Nov 2005 23:49:12 -0000 1.20
+++ platform/mac/macsurf.cpp 5 Apr 2006 17:15:49 -0000
@@ -66,6 +66,7 @@
#include "chxxtype.h"
#include "hxvctrl.h"
#include "hxvsurf.h"
+#include "baseobj.h"
#include "surface.h"
#include "vidosurf.h"
#include "sitetext.h"
Index: platform/mac/sitetext.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/mac/sitetext.cpp,v
retrieving revision 1.7
diff -u -r1.7 sitetext.cpp
--- platform/mac/sitetext.cpp 11 Mar 2005 19:58:06 -0000 1.7
+++ platform/mac/sitetext.cpp 5 Apr 2006 17:15:49 -0000
@@ -59,6 +59,7 @@
#include "chxxtype.h"
#include "hxvctrl.h"
#include "hxvsurf.h"
+#include "baseobj.h"
#include "surface.h"
#include "vidosurf.h"
#include "chxpckts.h"
Index: platform/unix/sitetext.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/unix/sitetext.cpp,v
retrieving revision 1.8
diff -u -r1.8 sitetext.cpp
--- platform/unix/sitetext.cpp 11 Mar 2005 19:58:07 -0000 1.8
+++ platform/unix/sitetext.cpp 5 Apr 2006 17:15:49 -0000
@@ -66,6 +66,7 @@
#include "hxvctrl.h"
#include "hxvsurf.h"
+#include "baseobj.h"
#include "surface.h"
#include "vidosurf.h"
#include "chxpckts.h"
Index: platform/win/sitetext.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/win/sitetext.cpp,v
retrieving revision 1.7
diff -u -r1.7 sitetext.cpp
--- platform/win/sitetext.cpp 11 Mar 2005 19:58:07 -0000 1.7
+++ platform/win/sitetext.cpp 5 Apr 2006 17:15:49 -0000
@@ -72,6 +72,7 @@
#include "hxengin.h"
#include "hxvctrl.h"
#include "hxvsurf.h"
+#include "baseobj.h"
#include "surface.h"
#include "vidosurf.h"
#ifdef _WIN32
Index: pub/baseroot.h
===================================================================
RCS file: /cvsroot/video/sitelib/pub/baseroot.h,v
retrieving revision 1.6
diff -u -r1.6 baseroot.h
--- pub/baseroot.h 16 Feb 2006 23:08:38 -0000 1.6
+++ pub/baseroot.h 5 Apr 2006 17:15:49 -0000
@@ -51,6 +51,7 @@
#include "hxvsurf.h"
#include "hxengin.h"
#include "hxslist.h"
+#include "baseobj.h"
#ifndef _BASEROOT_H_
#define _BASEROOT_H_
@@ -80,6 +81,7 @@
};
class CBaseRootSurface : public IUnknown
+ , public CHXBaseCountingObject
{
public:
virtual ~CBaseRootSurface();
Index: pub/basesite.h
===================================================================
RCS file: /cvsroot/video/sitelib/pub/basesite.h,v
retrieving revision 1.13
diff -u -r1.13 basesite.h
--- pub/basesite.h 23 Feb 2006 22:34:08 -0000 1.13
+++ pub/basesite.h 5 Apr 2006 17:15:49 -0000
@@ -61,6 +61,7 @@
#include "region.h"
#include "sitetran.h"
#include "coloracc.h"
+#include "baseobj.h"
class CHXBaseSite;
class CBaseSurface;
@@ -147,7 +148,9 @@
public IHXSiteComposition,
public IHXKeyBoardFocus,
public IHXDrawFocus,
- public IHXSubRectSite
+ public IHXSubRectSite,
+ public CHXBaseCountingObject
+
{
public:
Index: pub/basesurf.h
===================================================================
RCS file: /cvsroot/video/sitelib/pub/basesurf.h,v
retrieving revision 1.7
diff -u -r1.7 basesurf.h
--- pub/basesurf.h 17 Jan 2006 19:37:28 -0000 1.7
+++ pub/basesurf.h 5 Apr 2006 17:15:49 -0000
@@ -56,6 +56,7 @@
#include "region.h"
#include "hxmap.h"
#include "hxwin.h"
+#include "baseobj.h"
#if !defined(_GOLD) && 0
#include "timestmp.h"
@@ -116,7 +117,8 @@
class CBaseSurface :
public IHXSubRectVideoSurface,
public IHXVideoControl,
-public IHXOverlayResponse
+public IHXOverlayResponse,
+public CHXBaseCountingObject
{
public:
friend class CHXBaseSite;
Index: pub/surface.h
===================================================================
RCS file: /cvsroot/video/sitelib/pub/surface.h,v
retrieving revision 1.3
diff -u -r1.3 surface.h
--- pub/surface.h 9 Jul 2004 18:34:59 -0000 1.3
+++ pub/surface.h 5 Apr 2006 17:15:49 -0000
@@ -60,6 +60,7 @@
class CHXSurface : public IHXVideoSurface,
public IHXVideoControl
+ , public CHXBaseCountingObject
{
protected:
Index: pub/vidsurf2.h
===================================================================
RCS file: /cvsroot/video/sitelib/pub/vidsurf2.h,v
retrieving revision 1.4
diff -u -r1.4 vidsurf2.h
--- pub/vidsurf2.h 11 Mar 2005 19:58:08 -0000 1.4
+++ pub/vidsurf2.h 5 Apr 2006 17:15:49 -0000
@@ -59,6 +59,7 @@
// Look at CWinSurface2 for reference.
///////////////////////////////////////////////////////////////////////////////
class CVideoSurface2 : public IHXVideoSurface2
+ , public CHXBaseCountingObject
{
public: