summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2011-01-19 19:10:49 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2011-01-19 19:10:49 +0000
commita64a064d296f392f12d062af0824ea5d4e782dd8 (patch)
treebb28cd08b58b7a87cbe1c490dad0672f289a17f5 /src
parenta1227398c0ce070f69f9adf33b4c31bc6834e0bd (diff)
downloadVirtualBox-svn-a64a064d296f392f12d062af0824ea5d4e782dd8.tar.gz
Main. QT/FE: fix long standing COM issue
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@35638 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src')
-rw-r--r--src/VBox/Frontends/VBoxBFE/COMDefs.h3
-rw-r--r--src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp10
-rw-r--r--src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h149
-rw-r--r--src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl62
-rw-r--r--src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp8
-rw-r--r--src/VBox/Frontends/VirtualBox/src/main.cpp28
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp2
-rw-r--r--src/VBox/Main/glue/initterm.cpp92
-rw-r--r--src/VBox/Main/idl/comimpl.xsl4
-rw-r--r--src/VBox/Main/include/ApplianceImpl.h16
-rw-r--r--src/VBox/Main/include/AudioAdapterImpl.h4
-rw-r--r--src/VBox/Main/include/BIOSSettingsImpl.h4
-rw-r--r--src/VBox/Main/include/BandwidthControlImpl.h4
-rw-r--r--src/VBox/Main/include/BandwidthGroupImpl.h4
-rw-r--r--src/VBox/Main/include/ConsoleImpl.h6
-rw-r--r--src/VBox/Main/include/ConsoleVRDPServer.h4
-rw-r--r--src/VBox/Main/include/DHCPServerImpl.h4
-rw-r--r--src/VBox/Main/include/DisplayImpl.h4
-rw-r--r--src/VBox/Main/include/EventImpl.h12
-rw-r--r--src/VBox/Main/include/ExtPackManagerImpl.h12
-rw-r--r--src/VBox/Main/include/FramebufferImpl.h4
-rw-r--r--src/VBox/Main/include/GuestImpl.h4
-rw-r--r--src/VBox/Main/include/GuestOSTypeImpl.h4
-rw-r--r--src/VBox/Main/include/HostImpl.h4
-rw-r--r--src/VBox/Main/include/HostNetworkInterfaceImpl.h4
-rw-r--r--src/VBox/Main/include/HostUSBDeviceImpl.h4
-rw-r--r--src/VBox/Main/include/KeyboardImpl.h4
-rw-r--r--src/VBox/Main/include/MachineDebuggerImpl.h4
-rw-r--r--src/VBox/Main/include/MachineImpl.h12
-rw-r--r--src/VBox/Main/include/MediumAttachmentImpl.h4
-rw-r--r--src/VBox/Main/include/MediumFormatImpl.h4
-rw-r--r--src/VBox/Main/include/MediumImpl.h4
-rw-r--r--src/VBox/Main/include/MouseImpl.h4
-rw-r--r--src/VBox/Main/include/NATEngineImpl.h4
-rw-r--r--src/VBox/Main/include/NetworkAdapterImpl.h4
-rw-r--r--src/VBox/Main/include/ParallelPortImpl.h4
-rw-r--r--src/VBox/Main/include/PciDeviceAttachmentImpl.h8
-rw-r--r--src/VBox/Main/include/PerformanceImpl.h7
-rw-r--r--src/VBox/Main/include/ProgressCombinedImpl.h4
-rw-r--r--src/VBox/Main/include/ProgressImpl.h4
-rw-r--r--src/VBox/Main/include/ProgressProxyImpl.h4
-rw-r--r--src/VBox/Main/include/RemoteUSBDeviceImpl.h4
-rw-r--r--src/VBox/Main/include/SerialPortImpl.h4
-rw-r--r--src/VBox/Main/include/SessionImpl.h7
-rw-r--r--src/VBox/Main/include/SharedFolderImpl.h4
-rw-r--r--src/VBox/Main/include/SnapshotImpl.h4
-rw-r--r--src/VBox/Main/include/StorageControllerImpl.h4
-rw-r--r--src/VBox/Main/include/SystemPropertiesImpl.h4
-rw-r--r--src/VBox/Main/include/USBControllerImpl.h4
-rw-r--r--src/VBox/Main/include/USBDeviceFilterImpl.h8
-rw-r--r--src/VBox/Main/include/USBDeviceImpl.h4
-rw-r--r--src/VBox/Main/include/VFSExplorerImpl.h8
-rw-r--r--src/VBox/Main/include/VRDEServerImpl.h4
-rw-r--r--src/VBox/Main/include/VirtualBoxBase.h23
-rw-r--r--src/VBox/Main/include/VirtualBoxClientImpl.h4
-rw-r--r--src/VBox/Main/include/VirtualBoxImpl.h5
-rw-r--r--src/VBox/Main/src-all/EventImpl.cpp33
-rw-r--r--src/VBox/Main/src-all/ExtPackManagerImpl.cpp3
-rw-r--r--src/VBox/Main/src-all/PciDeviceAttachmentImpl.cpp3
-rw-r--r--src/VBox/Main/src-all/ProgressImpl.cpp6
-rw-r--r--src/VBox/Main/src-all/SharedFolderImpl.cpp3
-rw-r--r--src/VBox/Main/src-client/ConsoleImpl.cpp19
-rw-r--r--src/VBox/Main/src-client/ConsoleVRDPServer.cpp3
-rw-r--r--src/VBox/Main/src-client/DisplayImpl.cpp3
-rw-r--r--src/VBox/Main/src-client/GuestImpl.cpp3
-rw-r--r--src/VBox/Main/src-client/KeyboardImpl.cpp3
-rw-r--r--src/VBox/Main/src-client/MachineDebuggerImpl.cpp3
-rw-r--r--src/VBox/Main/src-client/MouseImpl.cpp3
-rw-r--r--src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp3
-rw-r--r--src/VBox/Main/src-client/SessionImpl.cpp13
-rw-r--r--src/VBox/Main/src-client/USBDeviceImpl.cpp3
-rw-r--r--src/VBox/Main/src-client/VirtualBoxClientImpl.cpp5
-rw-r--r--src/VBox/Main/src-server/AudioAdapterImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/BIOSSettingsImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/BandwidthControlImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/BandwidthGroupImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/DHCPServerImpl.cpp4
-rw-r--r--src/VBox/Main/src-server/GuestOSTypeImpl.cpp4
-rw-r--r--src/VBox/Main/src-server/HostImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/HostUSBDeviceImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/MachineImpl.cpp7
-rw-r--r--src/VBox/Main/src-server/MediumAttachmentImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/MediumFormatImpl.cpp4
-rw-r--r--src/VBox/Main/src-server/MediumImpl.cpp4
-rw-r--r--src/VBox/Main/src-server/NATEngineImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/NetworkAdapterImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/ParallelPortImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/PerformanceImpl.cpp7
-rw-r--r--src/VBox/Main/src-server/ProgressProxyImpl.cpp2
-rw-r--r--src/VBox/Main/src-server/SerialPortImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/SnapshotImpl.cpp7
-rw-r--r--src/VBox/Main/src-server/StorageControllerImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/SystemPropertiesImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/USBControllerImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/USBDeviceFilterImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/VRDEServerImpl.cpp3
-rw-r--r--src/VBox/Main/src-server/VirtualBoxImpl.cpp8
98 files changed, 402 insertions, 427 deletions
diff --git a/src/VBox/Frontends/VBoxBFE/COMDefs.h b/src/VBox/Frontends/VBoxBFE/COMDefs.h
index 5c8ea572f70..e9fa6a905a6 100644
--- a/src/VBox/Frontends/VBoxBFE/COMDefs.h
+++ b/src/VBox/Frontends/VBoxBFE/COMDefs.h
@@ -46,6 +46,9 @@
#define COM_INTERFACE_ENTRY(a)
#define COM_INTERFACE_ENTRY2(a,b)
#define END_COM_MAP()
+#define VBOX_DEFAULT_INTERFACE_ENTRIES(a)
+#define BaseFinalConstruct() (S_OK)
+#define BaseFinalRelease()
#ifndef RT_OS_WINDOWS
typedef unsigned long HRESULT;
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp b/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp
index a958c6a80b6..6fd59c1c908 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp
@@ -21,6 +21,7 @@
#if !defined (VBOX_WITH_XPCOM)
+
#else /* !defined (VBOX_WITH_XPCOM) */
/* Qt includes */
@@ -86,16 +87,11 @@ private:
/**
* Initializes COM/XPCOM.
*/
-HRESULT COMBase::InitializeCOM()
+HRESULT COMBase::InitializeCOM(bool fGui)
{
LogFlowFuncEnter();
- /* Note: On Win32, Qt somehow calls CoInitialize[Ex]() during creation of
- * the QApplication instance (didn't explore deeply why it does so) with
- * different flags which is incompatible with our multithreaded
- * apartment. com::Initialize() will properly care of this situation. */
-
- HRESULT rc = com::Initialize();
+ HRESULT rc = com::Initialize(fGui);
#if defined (VBOX_WITH_XPCOM)
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h b/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h
index b8fd651704b..6c24c07a422 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h
@@ -202,7 +202,7 @@ class COMBase
{
public:
- static HRESULT InitializeCOM();
+ static HRESULT InitializeCOM(bool fGui);
static HRESULT CleanupCOM();
/**
@@ -354,7 +354,7 @@ public:
protected:
/* no arbitrary instance creations */
- COMBase() : mRC (S_OK) {};
+ COMBase() : mRC (S_OK) {}
#if defined (VBOX_WITH_XPCOM)
static XPCOMEventQSocketListener *sSocketListener;
@@ -632,44 +632,61 @@ public:
// constructors & destructor
- CInterface() : mIface (NULL) {}
-
- CInterface (const CInterface &that) : B (that), mIface (that.mIface)
+ CInterface()
{
- addref (mIface);
+ clear();
}
- CInterface (I *aIface) : mIface (aIface) { addref (mIface); }
+ CInterface (const CInterface &that) : B (that)
+ {
+ clear();
+ mIface = that.mIface;
+ addref(ptr());
+ }
- virtual ~CInterface() { release (mIface); }
+ CInterface (I *aIface)
+ {
+ clear();
+ setPtr (aIface);
+ addref (aIface);
+ }
- // utility methods
+ virtual ~CInterface()
+ {
+ detach();
+#ifdef DEBUG
+ mDead = true;
+#endif
+ }
+ // utility methods
void createInstance (const CLSID &aClsId)
{
- AssertMsg (!mIface, ("Instance is already non-NULL\n"));
- if (!mIface)
+ AssertMsg (ptr() == NULL, ("Instance is already non-NULL\n"));
+ if (ptr() == NULL)
{
+ I* pObj = NULL;
#if !defined (VBOX_WITH_XPCOM)
-
B::mRC = CoCreateInstance (aClsId, NULL, CLSCTX_ALL,
- _ATL_IIDOF (I), (void **) &mIface);
-
-#else /* !defined (VBOX_WITH_XPCOM) */
-
+ _ATL_IIDOF (I), (void **) &pObj);
+#else
nsCOMPtr <nsIComponentManager> manager;
B::mRC = NS_GetComponentManager (getter_AddRefs (manager));
if (SUCCEEDED (B::mRC))
B::mRC = manager->CreateInstance (aClsId, nsnull, NS_GET_IID (I),
- (void **) &mIface);
-
-#endif /* !defined (VBOX_WITH_XPCOM) */
-
+ (void **) &pObj);
+#endif
+
+ if (SUCCEEDED (B::mRC))
+ setPtr(pObj);
+ else
+ setPtr(NULL);
+
/* fetch error info, but don't assert if it's missing -- many other
* reasons can lead to an error (w/o providing error info), not only
* the instance initialization code (that should always provide it) */
B::fetchErrorInfo (NULL, NULL);
- }
+ }
}
/**
@@ -679,18 +696,23 @@ public:
template <class OI>
void attach (OI *aIface)
{
+#ifdef DEBUG
+ Assert(!mDead);
+#endif
/* be aware of self assignment */
+ I* amIface = ptr();
addref (aIface);
- release (mIface);
+ release (amIface);
if (aIface)
{
- mIface = NULL;
- B::mRC = aIface->QueryInterface (COM_IIDOF (I), (void **) &mIface);
+ amIface = NULL;
+ B::mRC = aIface->QueryInterface (COM_IIDOF (I), (void **) &amIface);
release (aIface);
+ setPtr(amIface);
}
else
{
- mIface = NULL;
+ setPtr(NULL);
B::mRC = S_OK;
}
};
@@ -698,18 +720,34 @@ public:
/** Specialization of attach() for our own interface I. Never fails. */
void attach (I *aIface)
{
+#ifdef DEBUG
+ Assert(!mDead);
+#endif
/* be aware of self assignment */
addref (aIface);
- release (mIface);
- mIface = aIface;
+ release (ptr());
+ setPtr(aIface);
B::mRC = S_OK;
};
/** Detaches from the underlying interface pointer. */
- void detach() { release (mIface); mIface = NULL; }
+ void detach()
+ {
+#ifdef DEBUG
+ Assert(!mDead);
+#endif
+ release (ptr());
+ setPtr(NULL);
+ }
/** Returns @c true if not attached to any interface pointer. */
- bool isNull() const { return mIface == NULL; }
+ bool isNull() const
+ {
+#ifdef DEBUG
+ Assert(!mDead);
+#endif
+ return mIface == NULL;
+ }
/**
* Returns @c true if the result code represents success (with or without
@@ -732,7 +770,7 @@ public:
CInterface &operator= (const CInterface &that)
{
- attach (that.mIface);
+ attach (that.ptr());
B::operator= (that);
return *this;
}
@@ -747,18 +785,44 @@ public:
* Returns the raw interface pointer. Not intended to be used for anything
* else but in generated wrappers and for debugging. You've been warned.
*/
- I *raw() const { return mIface; }
+ I *raw() const
+ {
+ return ptr();
+ }
- bool operator== (const CInterface &that) const { return mIface == that.mIface; }
- bool operator!= (const CInterface &that) const { return mIface != that.mIface; }
+ bool operator== (const CInterface &that) const { return ptr() == that.ptr(); }
+ bool operator!= (const CInterface &that) const { return ptr() != that.ptr(); }
-/**
- * @todo: rethink if we'll ever need 'protected' back, removed to allow mIface access in rather
- * nontrivial inheritance situations, see 'friend wrappers' code in COMWrappers.xsl
- */
-//protected:
+ I* ptr() const
+ {
+#ifdef DEBUG
+ Assert(!mDead);
+#endif
- mutable I *mIface;
+ return mIface;
+ }
+
+ void setPtr(I* aObj) const
+ {
+#ifdef DEBUG
+ Assert(!mDead);
+#endif
+ mIface = aObj;
+ }
+
+private:
+#ifdef DEBUG
+ bool mDead;
+#endif
+ mutable I * mIface;
+
+ void clear()
+ {
+ mIface = NULL;
+#ifdef DEBUG
+ mDead = false;
+#endif
+ }
};
/////////////////////////////////////////////////////////////////////////////
@@ -775,7 +839,7 @@ public:
template <class OI, class OB>
explicit CUnknown (const CInterface <OI, OB> &that)
{
- attach (that.mIface);
+ attach (that.ptr());
if (SUCCEEDED (mRC))
{
/* preserve old error info if any */
@@ -801,7 +865,7 @@ public:
template <class OI, class OB>
CUnknown &operator= (const CInterface <OI, OB> &that)
{
- attach (that.mIface);
+ attach (that.ptr());
if (SUCCEEDED (mRC))
{
/* preserve old error info if any */
@@ -832,9 +896,6 @@ public:
Base::operator= (aIface);
return *this;
}
-
- /* @internal Used in generated wrappers. Never use directly. */
- IUnknown *&rawRef() { return mIface; };
};
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl b/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl
index 87ed3788641..fe68ad81b74 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl
+++ b/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl
@@ -950,7 +950,7 @@
<xsl:if test="$define">
<xsl:text>&#x0A;{&#x0A;</xsl:text>
<!-- iface assertion -->
- <xsl:text> AssertReturnVoid(mIface);&#x0A;</xsl:text>
+ <xsl:text> AssertReturnVoid(ptr());&#x0A;</xsl:text>
<!-- method call -->
<xsl:call-template name="composeMethodCall">
<xsl:with-param name="isSetter" select="'yes'"/>
@@ -989,7 +989,7 @@
<xsl:apply-templates select="$return/@type" mode="initializer"/>
<xsl:text>;&#x0A;</xsl:text>
<!-- iface assertion -->
- <xsl:text> AssertReturn(mIface, a</xsl:text>
+ <xsl:text> AssertReturn(ptr(), a</xsl:text>
<xsl:call-template name="capitalize">
<xsl:with-param name="str" select="$return/@name"/>
</xsl:call-template>
@@ -1096,7 +1096,7 @@
</xsl:when>
</xsl:choose>
<!-- start the call -->
- <xsl:text> mRC = mIface-></xsl:text>
+ <xsl:text> mRC = ptr()-></xsl:text>
<xsl:choose>
<!-- attribute method call -->
<xsl:when test="name()='attribute'">
@@ -1136,6 +1136,11 @@
</xsl:when>
</xsl:choose>
<xsl:text>);&#x0A;</xsl:text>
+
+ <xsl:text>#ifdef RT_OS_WINDOWS&#x0A;</xsl:text>
+ <xsl:text> Assert(mRC != RPC_E_WRONG_THREAD);&#x0A;</xsl:text>
+ <xsl:text>#endif;&#x0A;</xsl:text>
+
<!-- apply 'post-call' hooks -->
<xsl:choose>
<xsl:when test="name()='attribute'">
@@ -1200,7 +1205,7 @@
<xsl:otherwise>
<xsl:if test="$supports='strict' or $supports='yes'">
<xsl:text> if (RT_UNLIKELY(mRC != S_OK))&#x0A; {&#x0A;</xsl:text>
- <xsl:text> fetchErrorInfo(mIface, &amp;COM_IIDOF(Base::Iface));&#x0A;</xsl:text>
+ <xsl:text> fetchErrorInfo(ptr(), &amp;COM_IIDOF(Base::Iface));&#x0A;</xsl:text>
<xsl:if test="$supports='strict'">
<xsl:text> AssertMsg(errInfo.isFullAvailable(), </xsl:text>
<xsl:text>("for RC=0x%08X\n", mRC));&#x0A;</xsl:text>
@@ -1293,28 +1298,10 @@
<xsl:call-template name="capitalize">
<xsl:with-param name="str" select="@name"/>
</xsl:call-template>
- <xsl:choose>
- <xsl:when test="@type='$unknown'">
- <xsl:text>.raw()</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>.mIface</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:text>.ptr()</xsl:text>
</xsl:when>
<xsl:when test="$isOut">
- <xsl:text>&amp;a</xsl:text>
- <xsl:call-template name="capitalize">
- <xsl:with-param name="str" select="@name"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="@type='$unknown'">
- <xsl:text>.rawRef()</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>.mIface</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:value-of select="concat('&amp;', @name, 'Ptr')"/>
</xsl:when>
</xsl:choose>
</xsl:when>
@@ -1782,6 +1769,11 @@
(ancestor::library/if[@target=$self_target]/enum[@name=current()/@type])
)"/>
+ <xsl:variable name="is_out" select="(
+ (name()='attribute' and not($isSetter)) or
+ (name()='param' and (@dir='out' or @dir='return'))
+ )"/>
+
<xsl:choose>
<xsl:when test="$when='pre-call'">
<xsl:choose>
@@ -1837,13 +1829,24 @@
<xsl:text>);&#x0A;</xsl:text>
</xsl:if>
</xsl:when>
+ <xsl:when test="$is_out and ($is_iface or (@type='$unknown'))">
+ <xsl:text> </xsl:text>
+ <xsl:choose>
+ <xsl:when test="@type='$unknown'">
+ <xsl:text>IUnknown</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="concat('* ',@name,'Ptr = NULL;&#10;')"/>
+ </xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="$when='post-call'">
<xsl:choose>
<xsl:when test="@safearray='yes'">
- <xsl:if test="(name()='attribute' and not($isSetter)) or
- (name()='param' and (@dir='out' or @dir='return'))">
+ <xsl:if test="$is_out">
<!-- convert SafeArray to QVector -->
<xsl:choose>
<!-- interface types need special treatment here -->
@@ -1863,6 +1866,13 @@
<xsl:text>);&#x0A;</xsl:text>
</xsl:if>
</xsl:when>
+ <xsl:when test="$is_out and ($is_iface or (@type='$unknown'))">
+ <xsl:text> a</xsl:text>
+ <xsl:call-template name="capitalize">
+ <xsl:with-param name="str" select="@name"/>
+ </xsl:call-template>
+ <xsl:value-of select="concat('.setPtr(',@name,'Ptr);&#10;')"/>
+ </xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
index 48445dbdf59..79e6b944eb6 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
@@ -2389,7 +2389,7 @@ void VBoxGlobal::startEnumeratingMedia()
virtual void run()
{
LogFlow (("MediaEnumThread started.\n"));
- COMBase::InitializeCOM();
+ COMBase::InitializeCOM(false);
CVirtualBox mVBox = vboxGlobal().virtualBox();
QObject *self = &vboxGlobal();
@@ -4764,16 +4764,12 @@ void VBoxGlobal::init()
mVerString += " [DEBUG]";
#endif
-#ifdef Q_WS_WIN
- /* COM for the main thread is initialized in main() */
-#else
- HRESULT rc = COMBase::InitializeCOM();
+ HRESULT rc = COMBase::InitializeCOM(true);
if (FAILED (rc))
{
vboxProblem().cannotInitCOM (rc);
return;
}
-#endif
mVBox.createInstance (CLSID_VirtualBox);
if (!mVBox.isOk())
diff --git a/src/VBox/Frontends/VirtualBox/src/main.cpp b/src/VBox/Frontends/VirtualBox/src/main.cpp
index f4a626c9490..b5ba175d8ce 100644
--- a/src/VBox/Frontends/VirtualBox/src/main.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/main.cpp
@@ -290,19 +290,6 @@ extern "C" DECLEXPORT(int) TrustedMain (int argc, char **argv, char ** /*envp*/)
ShutUpAppKit();
# endif
-#ifdef Q_WS_WIN
- /* Initialize COM early, before QApplication calls OleInitialize(), to
- * make sure we enter the multi threaded apartment instead of a single
- * threaded one. Note that this will make some non-threadsafe system
- * services that use OLE and require STA (such as Drag&Drop) not work
- * anymore, however it's still better because otherwise VBox will not work
- * on some Windows XP systems at all since it requires MTA (we cannot
- * leave STA by calling CoUninitialize() and re-enter MTA on those systems
- * for some unknown reason), see also src/VBox/Main/glue/initterm.cpp. */
- /// @todo find a proper solution that satisfies both OLE and VBox
- HRESULT hrc = COMBase::InitializeCOM();
-#endif
-
for (int i=0; i<argc; i++)
if ( !strcmp(argv[i], "-h")
|| !strcmp(argv[i], "-?")
@@ -463,15 +450,6 @@ extern "C" DECLEXPORT(int) TrustedMain (int argc, char **argv, char ** /*envp*/)
do
{
-#ifdef Q_WS_WIN
- /* Check for the COM error after we've initialized Qt */
- if (FAILED (hrc))
- {
- vboxProblem().cannotInitCOM (hrc);
- break;
- }
-#endif
-
if (!vboxGlobal().isValid())
break;
@@ -554,12 +532,6 @@ extern "C" DECLEXPORT(int) TrustedMain (int argc, char **argv, char ** /*envp*/)
while (0);
}
-#ifdef Q_WS_WIN
- /* See COMBase::initializeCOM() above */
- if (SUCCEEDED (hrc))
- COMBase::CleanupCOM();
-#endif
-
LogFlowFunc (("rc=%d\n", rc));
LogFlowFuncLeave();
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
index d734c1baa28..50d924e03bd 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
@@ -66,6 +66,7 @@ void UIFrameBufferQImage::paintEvent(QPaintEvent *pEvent)
/* Scaled image by default is empty: */
QImage scaledImage;
+
/* If scaled-factor is set and current image is NOT null: */
if (m_scaledSize.isValid() && !m_img.isNull())
{
@@ -92,6 +93,7 @@ void UIFrameBufferQImage::paintEvent(QPaintEvent *pEvent)
QPainter painter(m_pMachineView->viewport());
+
if ((ulong)r.width() < m_width * 2 / 3)
{
/* This method is faster for narrow updates */
diff --git a/src/VBox/Main/glue/initterm.cpp b/src/VBox/Main/glue/initterm.cpp
index 0432811c6e1..7e92280f086 100644
--- a/src/VBox/Main/glue/initterm.cpp
+++ b/src/VBox/Main/glue/initterm.cpp
@@ -246,87 +246,30 @@ static uint32_t gCOMMainInitCount = 0;
*
* @return S_OK on success and a COM result code in case of failure.
*/
-HRESULT Initialize()
+HRESULT Initialize(bool fGui)
{
HRESULT rc = E_FAIL;
#if !defined(VBOX_WITH_XPCOM)
- DWORD flags = COINIT_MULTITHREADED
+ /**
+ * We initialize COM in GUI thread in STA, to be compliant with QT and
+ * OLE requirments (for example to allow D&D), while other threads
+ * initialized in regular MTA. To allow fast proxyless access from
+ * GUI thread to COM objects, we explicitly provide our COM objects
+ * with free threaded marshaller.
+ * !!!!! Please think twice before touching this code !!!!!
+ */
+ DWORD flags = fGui ?
+ COINIT_APARTMENTTHREADED
+ | COINIT_SPEED_OVER_MEMORY
+ :
+ COINIT_MULTITHREADED
| COINIT_DISABLE_OLE1DDE
| COINIT_SPEED_OVER_MEMORY;
rc = CoInitializeEx(NULL, flags);
- /// @todo the below rough method of changing the apartment type doesn't
- /// work on some systems for unknown reason (CoUninitialize() simply does
- /// nothing there, or at least all 10 000 of subsequent CoInitializeEx()
- /// continue to return RPC_E_CHANGED_MODE there). The problem on those
- /// systems is related to the "Extend support for advanced text services
- /// to all programs" checkbox in the advanced language settings dialog,
- /// i.e. the problem appears when this checkbox is checked and disappears
- /// if you clear it. For this reason, we disable the code below and
- /// instead initialize COM in MTA as early as possible, before 3rd party
- /// libraries we use have done so (i.e. Qt).
-# if 0
- /* If we fail to set the necessary apartment model, it may mean that some
- * DLL that was indirectly loaded by the process calling this function has
- * already initialized COM on the given thread in an incompatible way
- * which we can't leave with. Therefore, we try to fix this by using the
- * brute force method: */
-
- if (rc == RPC_E_CHANGED_MODE)
- {
- /* Before we use brute force, we need to check if we are in the
- * neutral threaded apartment -- in this case there is no need to
- * worry at all. */
-
- rc = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
- if (rc == RPC_E_CHANGED_MODE)
- {
- /* This is a neutral apartment, reset the error */
- rc = S_OK;
-
- LogFlowFunc(("COM is already initialized in neutral threaded "
- "apartment mode,\nwill accept it.\n"));
- }
- else if (rc == S_FALSE)
- {
- /* balance the test CoInitializeEx above */
- CoUninitialize();
- rc = RPC_E_CHANGED_MODE;
-
- LogFlowFunc(("COM is already initialized in single threaded "
- "apartment mode,\nwill reinitialize as "
- "multi threaded.\n"));
-
- enum { MaxTries = 10000 };
- int tries = MaxTries;
- while (rc == RPC_E_CHANGED_MODE && tries --)
- {
- CoUninitialize();
- rc = CoInitializeEx(NULL, flags);
- if (rc == S_OK)
- {
- /* We've successfully reinitialized COM; restore the
- * initialization reference counter */
-
- LogFlowFunc(("Will call CoInitializeEx() %d times.\n",
- MaxTries - tries));
-
- while (tries ++ < MaxTries)
- {
- rc = CoInitializeEx(NULL, flags);
- Assert(rc == S_FALSE);
- }
- }
- }
- }
- else
- AssertMsgFailed(("rc=%08X\n", rc));
- }
-# endif
-
/* the overall result must be either S_OK or S_FALSE (S_FALSE means
* "already initialized using the same apartment model") */
AssertMsg(rc == S_OK || rc == S_FALSE, ("rc=%08X\n", rc));
@@ -341,6 +284,10 @@ HRESULT Initialize()
ASMAtomicCmpXchgHandle(&gCOMMainThread, hSelf, NIL_RTTHREAD, fRc);
else
fRc = false;
+
+ if (fGui)
+ Assert(RTThreadIsMain(hSelf));
+
if (!fRc)
{
if ( gCOMMainThread == hSelf
@@ -359,6 +306,9 @@ HRESULT Initialize()
#else /* !defined (VBOX_WITH_XPCOM) */
+ /* Unused here */
+ (void)fGui;
+
if (ASMAtomicXchgBool(&gIsXPCOMInitialized, true) == true)
{
/* XPCOM is already initialized on the main thread, no special
diff --git a/src/VBox/Main/idl/comimpl.xsl b/src/VBox/Main/idl/comimpl.xsl
index e037500faa0..4a566d56cab 100644
--- a/src/VBox/Main/idl/comimpl.xsl
+++ b/src/VBox/Main/idl/comimpl.xsl
@@ -66,10 +66,10 @@
<xsl:value-of select="//interface[@name=$name]/@extends" />
</xsl:variable>
- <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', $name, ')&#10;')" />
+ <xsl:value-of select="concat(' VBOX_DEFAULT_INTERFACE_ENTRIES(', $name, ')&#10;')" />
<xsl:choose>
<xsl:when test="$extends='$unknown'">
- <xsl:value-of select=" ' COM_INTERFACE_ENTRY(IDispatch)&#10;'" />
+ <!-- Reached base -->
</xsl:when>
<xsl:when test="//interface[@name=$extends]">
<xsl:call-template name="genComEntry">
diff --git a/src/VBox/Main/include/ApplianceImpl.h b/src/VBox/Main/include/ApplianceImpl.h
index f656f00c61c..9d34b8d032e 100644
--- a/src/VBox/Main/include/ApplianceImpl.h
+++ b/src/VBox/Main/include/ApplianceImpl.h
@@ -67,9 +67,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Appliance)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IAppliance)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IAppliance)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (Appliance)
@@ -82,8 +80,8 @@ public:
};
// public initializer/uninitializer for internal purposes only
- HRESULT FinalConstruct() { return S_OK; }
- void FinalRelease() { uninit(); }
+ HRESULT FinalConstruct() { return BaseFinalConstruct(); }
+ void FinalRelease() { uninit(); BaseFinalRelease(); }
HRESULT init(VirtualBox *aVirtualBox);
void uninit();
@@ -251,16 +249,14 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(VirtualSystemDescription)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IVirtualSystemDescription)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IVirtualSystemDescription)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (VirtualSystemDescription)
// public initializer/uninitializer for internal purposes only
- HRESULT FinalConstruct() { return S_OK; }
- void FinalRelease() { uninit(); }
+ HRESULT FinalConstruct() { return BaseFinalConstruct(); }
+ void FinalRelease() { uninit(); BaseFinalRelease(); }
HRESULT init();
void uninit();
diff --git a/src/VBox/Main/include/AudioAdapterImpl.h b/src/VBox/Main/include/AudioAdapterImpl.h
index 2bb56756227..306316b0746 100644
--- a/src/VBox/Main/include/AudioAdapterImpl.h
+++ b/src/VBox/Main/include/AudioAdapterImpl.h
@@ -49,9 +49,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(AudioAdapter)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IAudioAdapter)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IAudioAdapter)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (AudioAdapter)
diff --git a/src/VBox/Main/include/BIOSSettingsImpl.h b/src/VBox/Main/include/BIOSSettingsImpl.h
index db0435a1408..6713410015d 100644
--- a/src/VBox/Main/include/BIOSSettingsImpl.h
+++ b/src/VBox/Main/include/BIOSSettingsImpl.h
@@ -41,9 +41,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(BIOSSettings)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IBIOSSettings)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IBIOSSettings)
END_COM_MAP()
HRESULT FinalConstruct();
diff --git a/src/VBox/Main/include/BandwidthControlImpl.h b/src/VBox/Main/include/BandwidthControlImpl.h
index d27ab473b36..98101cc5db0 100644
--- a/src/VBox/Main/include/BandwidthControlImpl.h
+++ b/src/VBox/Main/include/BandwidthControlImpl.h
@@ -39,9 +39,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(BandwidthControl)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IBandwidthControl)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IBandwidthControl)
END_COM_MAP()
BandwidthControl() { };
diff --git a/src/VBox/Main/include/BandwidthGroupImpl.h b/src/VBox/Main/include/BandwidthGroupImpl.h
index 9c05390424b..3ceb5a2c668 100644
--- a/src/VBox/Main/include/BandwidthGroupImpl.h
+++ b/src/VBox/Main/include/BandwidthGroupImpl.h
@@ -33,9 +33,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(BandwidthGroup)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IBandwidthGroup)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IBandwidthGroup)
END_COM_MAP()
BandwidthGroup() { };
diff --git a/src/VBox/Main/include/ConsoleImpl.h b/src/VBox/Main/include/ConsoleImpl.h
index f1a13ca6568..a061b2780ec 100644
--- a/src/VBox/Main/include/ConsoleImpl.h
+++ b/src/VBox/Main/include/ConsoleImpl.h
@@ -97,9 +97,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Console)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IConsole)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IConsole)
END_COM_MAP()
Console();
@@ -755,7 +753,7 @@ private:
}
}
mCallbackData;
- COM_STRUCT_OR_CLASS(IEventListener) *mVmListner;
+ COM_STRUCT_OR_CLASS(IEventListener) *mVmListener;
friend struct VMTask;
};
diff --git a/src/VBox/Main/include/ConsoleVRDPServer.h b/src/VBox/Main/include/ConsoleVRDPServer.h
index 3318c9f6e7b..0c0a1d7fa46 100644
--- a/src/VBox/Main/include/ConsoleVRDPServer.h
+++ b/src/VBox/Main/include/ConsoleVRDPServer.h
@@ -241,9 +241,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(VRDEServerInfo)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IVRDEServerInfo)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IVRDEServerInfo)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (VRDEServerInfo)
diff --git a/src/VBox/Main/include/DHCPServerImpl.h b/src/VBox/Main/include/DHCPServerImpl.h
index 0ed2cebca60..674f3c21658 100644
--- a/src/VBox/Main/include/DHCPServerImpl.h
+++ b/src/VBox/Main/include/DHCPServerImpl.h
@@ -44,9 +44,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP (DHCPServer)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IDHCPServer)
- COM_INTERFACE_ENTRY (IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IDHCPServer)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (DHCPServer)
diff --git a/src/VBox/Main/include/DisplayImpl.h b/src/VBox/Main/include/DisplayImpl.h
index e9446861591..7a5cd75b85d 100644
--- a/src/VBox/Main/include/DisplayImpl.h
+++ b/src/VBox/Main/include/DisplayImpl.h
@@ -108,9 +108,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Display)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IDisplay)
- COM_INTERFACE_ENTRY2(IDispatch,IDisplay)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IDisplay)
COM_INTERFACE_ENTRY(IEventListener)
END_COM_MAP()
diff --git a/src/VBox/Main/include/EventImpl.h b/src/VBox/Main/include/EventImpl.h
index f7be3973307..ad795595c4f 100644
--- a/src/VBox/Main/include/EventImpl.h
+++ b/src/VBox/Main/include/EventImpl.h
@@ -33,9 +33,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(VBoxEvent)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IEvent)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IEvent)
END_COM_MAP()
VBoxEvent() {}
@@ -75,10 +73,8 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(VBoxVetoEvent)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY2(IEvent, IVetoEvent)
- COM_INTERFACE_ENTRY(IVetoEvent)
- COM_INTERFACE_ENTRY2(IDispatch, IVetoEvent)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IVetoEvent)
END_COM_MAP()
VBoxVetoEvent() {}
@@ -139,9 +135,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(EventSource)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IEventSource)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IEventSource)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(EventSource)
diff --git a/src/VBox/Main/include/ExtPackManagerImpl.h b/src/VBox/Main/include/ExtPackManagerImpl.h
index 9a4a3286392..236219419bd 100644
--- a/src/VBox/Main/include/ExtPackManagerImpl.h
+++ b/src/VBox/Main/include/ExtPackManagerImpl.h
@@ -36,10 +36,8 @@ public:
DECLARE_NOT_AGGREGATABLE(ExtPackFile)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(ExtPackFile)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IExtPackFile)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IExtPackFile)
COM_INTERFACE_ENTRY(IExtPackBase)
- COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(ExtPackFile)
@@ -101,10 +99,8 @@ public:
DECLARE_NOT_AGGREGATABLE(ExtPack)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(ExtPack)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IExtPack)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IExtPack)
COM_INTERFACE_ENTRY(IExtPackBase)
- COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(ExtPack)
@@ -192,9 +188,7 @@ class ATL_NO_VTABLE ExtPackManager :
DECLARE_NOT_AGGREGATABLE(ExtPackManager)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(ExtPackManager)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IExtPackManager)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IExtPackManager)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
diff --git a/src/VBox/Main/include/FramebufferImpl.h b/src/VBox/Main/include/FramebufferImpl.h
index b28d37bc02f..90bd95e20b7 100644
--- a/src/VBox/Main/include/FramebufferImpl.h
+++ b/src/VBox/Main/include/FramebufferImpl.h
@@ -38,9 +38,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP (Framebuffer)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IFramebuffer)
- COM_INTERFACE_ENTRY (IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IFramebuffer)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (Framebuffer)
diff --git a/src/VBox/Main/include/GuestImpl.h b/src/VBox/Main/include/GuestImpl.h
index ab134b72e1a..4666a195d03 100644
--- a/src/VBox/Main/include/GuestImpl.h
+++ b/src/VBox/Main/include/GuestImpl.h
@@ -58,9 +58,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Guest)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IGuest)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IGuest)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (Guest)
diff --git a/src/VBox/Main/include/GuestOSTypeImpl.h b/src/VBox/Main/include/GuestOSTypeImpl.h
index 00fed7ebc9f..f1c196a4487 100644
--- a/src/VBox/Main/include/GuestOSTypeImpl.h
+++ b/src/VBox/Main/include/GuestOSTypeImpl.h
@@ -35,9 +35,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(GuestOSType)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IGuestOSType)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestOSType)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(GuestOSType)
diff --git a/src/VBox/Main/include/HostImpl.h b/src/VBox/Main/include/HostImpl.h
index 2de1e9173ae..81ee65f6e14 100644
--- a/src/VBox/Main/include/HostImpl.h
+++ b/src/VBox/Main/include/HostImpl.h
@@ -45,9 +45,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Host)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IHost)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IHost)
END_COM_MAP()
HRESULT FinalConstruct();
diff --git a/src/VBox/Main/include/HostNetworkInterfaceImpl.h b/src/VBox/Main/include/HostNetworkInterfaceImpl.h
index 3336bb6eb06..bdb6a344585 100644
--- a/src/VBox/Main/include/HostNetworkInterfaceImpl.h
+++ b/src/VBox/Main/include/HostNetworkInterfaceImpl.h
@@ -42,9 +42,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP (HostNetworkInterface)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IHostNetworkInterface)
- COM_INTERFACE_ENTRY (IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IHostNetworkInterface)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (HostNetworkInterface)
diff --git a/src/VBox/Main/include/HostUSBDeviceImpl.h b/src/VBox/Main/include/HostUSBDeviceImpl.h
index 459c31bd14f..9a420dbd7f5 100644
--- a/src/VBox/Main/include/HostUSBDeviceImpl.h
+++ b/src/VBox/Main/include/HostUSBDeviceImpl.h
@@ -180,10 +180,8 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(HostUSBDevice)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IHostUSBDevice)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IHostUSBDevice)
COM_INTERFACE_ENTRY(IUSBDevice)
- COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (HostUSBDevice)
diff --git a/src/VBox/Main/include/KeyboardImpl.h b/src/VBox/Main/include/KeyboardImpl.h
index 90661666fa2..31246982c6b 100644
--- a/src/VBox/Main/include/KeyboardImpl.h
+++ b/src/VBox/Main/include/KeyboardImpl.h
@@ -57,9 +57,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Keyboard)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IKeyboard)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IKeyboard)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(Keyboard)
diff --git a/src/VBox/Main/include/MachineDebuggerImpl.h b/src/VBox/Main/include/MachineDebuggerImpl.h
index 90e330ba62a..0cd1d91d9e1 100644
--- a/src/VBox/Main/include/MachineDebuggerImpl.h
+++ b/src/VBox/Main/include/MachineDebuggerImpl.h
@@ -37,9 +37,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(MachineDebugger)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IMachineDebugger)
- COM_INTERFACE_ENTRY (IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IMachineDebugger)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (MachineDebugger)
diff --git a/src/VBox/Main/include/MachineImpl.h b/src/VBox/Main/include/MachineImpl.h
index 98e82d030e3..5c1d9496741 100644
--- a/src/VBox/Main/include/MachineImpl.h
+++ b/src/VBox/Main/include/MachineImpl.h
@@ -317,9 +317,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Machine)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IMachine)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IMachine)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(Machine)
@@ -902,9 +900,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(SessionMachine)
- COM_INTERFACE_ENTRY2(IDispatch, IMachine)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IMachine)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IMachine)
COM_INTERFACE_ENTRY(IInternalMachineControl)
END_COM_MAP()
@@ -1113,9 +1109,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(SnapshotMachine)
- COM_INTERFACE_ENTRY2(IDispatch, IMachine)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IMachine)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IMachine)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(SnapshotMachine)
diff --git a/src/VBox/Main/include/MediumAttachmentImpl.h b/src/VBox/Main/include/MediumAttachmentImpl.h
index e6994ef469b..0c3792825b6 100644
--- a/src/VBox/Main/include/MediumAttachmentImpl.h
+++ b/src/VBox/Main/include/MediumAttachmentImpl.h
@@ -33,9 +33,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(MediumAttachment)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IMediumAttachment)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IMediumAttachment)
END_COM_MAP()
MediumAttachment() { };
diff --git a/src/VBox/Main/include/MediumFormatImpl.h b/src/VBox/Main/include/MediumFormatImpl.h
index fd0b8be529c..26639243bea 100644
--- a/src/VBox/Main/include/MediumFormatImpl.h
+++ b/src/VBox/Main/include/MediumFormatImpl.h
@@ -75,9 +75,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(MediumFormat)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IMediumFormat)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IMediumFormat)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(MediumFormat)
diff --git a/src/VBox/Main/include/MediumImpl.h b/src/VBox/Main/include/MediumImpl.h
index 966f2bf3ff8..3ece921d2ef 100644
--- a/src/VBox/Main/include/MediumImpl.h
+++ b/src/VBox/Main/include/MediumImpl.h
@@ -50,9 +50,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Medium)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IMedium)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IMedium)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(Medium)
diff --git a/src/VBox/Main/include/MouseImpl.h b/src/VBox/Main/include/MouseImpl.h
index 8e1ff00ed74..c6d60cd3468 100644
--- a/src/VBox/Main/include/MouseImpl.h
+++ b/src/VBox/Main/include/MouseImpl.h
@@ -46,9 +46,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Mouse)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IMouse)
- COM_INTERFACE_ENTRY2 (IDispatch, IMouse)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IMouse)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (Mouse)
diff --git a/src/VBox/Main/include/NATEngineImpl.h b/src/VBox/Main/include/NATEngineImpl.h
index 9ddd760e8b8..fd4de8fa299 100644
--- a/src/VBox/Main/include/NATEngineImpl.h
+++ b/src/VBox/Main/include/NATEngineImpl.h
@@ -73,9 +73,7 @@ class ATL_NO_VTABLE NATEngine :
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(NATEngine)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (INATEngine)
- COM_INTERFACE_ENTRY2 (IDispatch, INATEngine)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (INATEngine)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (NATEngine)
diff --git a/src/VBox/Main/include/NetworkAdapterImpl.h b/src/VBox/Main/include/NetworkAdapterImpl.h
index c3f29fa5192..ca61425880f 100644
--- a/src/VBox/Main/include/NetworkAdapterImpl.h
+++ b/src/VBox/Main/include/NetworkAdapterImpl.h
@@ -78,9 +78,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(NetworkAdapter)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (INetworkAdapter)
- COM_INTERFACE_ENTRY2 (IDispatch, INetworkAdapter)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (INetworkAdapter)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (NetworkAdapter)
diff --git a/src/VBox/Main/include/ParallelPortImpl.h b/src/VBox/Main/include/ParallelPortImpl.h
index 1af1b0e1ca4..d646cd90805 100644
--- a/src/VBox/Main/include/ParallelPortImpl.h
+++ b/src/VBox/Main/include/ParallelPortImpl.h
@@ -38,9 +38,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(ParallelPort)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IParallelPort)
- COM_INTERFACE_ENTRY2 (IDispatch, IParallelPort)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IParallelPort)
END_COM_MAP()
ParallelPort() {}
diff --git a/src/VBox/Main/include/PciDeviceAttachmentImpl.h b/src/VBox/Main/include/PciDeviceAttachmentImpl.h
index 9990a27910c..f3ad1fe4bce 100644
--- a/src/VBox/Main/include/PciDeviceAttachmentImpl.h
+++ b/src/VBox/Main/include/PciDeviceAttachmentImpl.h
@@ -34,9 +34,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(PciAddress)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IPciAddress)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IPciAddress)
END_COM_MAP()
PciAddress() { }
@@ -98,9 +96,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(PciDeviceAttachment)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IPciDeviceAttachment)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IPciDeviceAttachment)
END_COM_MAP()
PciDeviceAttachment() { }
diff --git a/src/VBox/Main/include/PerformanceImpl.h b/src/VBox/Main/include/PerformanceImpl.h
index 0f1aae5b10f..4fa2bb65167 100644
--- a/src/VBox/Main/include/PerformanceImpl.h
+++ b/src/VBox/Main/include/PerformanceImpl.h
@@ -57,8 +57,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP (PerformanceMetric)
- COM_INTERFACE_ENTRY (IPerformanceMetric)
- COM_INTERFACE_ENTRY (IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IPerformanceMetric)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (PerformanceMetric)
@@ -125,9 +124,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(PerformanceCollector)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IPerformanceCollector)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IPerformanceCollector)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (PerformanceCollector)
diff --git a/src/VBox/Main/include/ProgressCombinedImpl.h b/src/VBox/Main/include/ProgressCombinedImpl.h
index 7e12602b214..2a920622164 100644
--- a/src/VBox/Main/include/ProgressCombinedImpl.h
+++ b/src/VBox/Main/include/ProgressCombinedImpl.h
@@ -76,9 +76,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP (CombinedProgress)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IProgress)
- COM_INTERFACE_ENTRY2 (IDispatch, IProgress)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IProgress)
END_COM_MAP()
HRESULT FinalConstruct();
diff --git a/src/VBox/Main/include/ProgressImpl.h b/src/VBox/Main/include/ProgressImpl.h
index 8bbda4af15c..e58ce3d0a3d 100644
--- a/src/VBox/Main/include/ProgressImpl.h
+++ b/src/VBox/Main/include/ProgressImpl.h
@@ -142,9 +142,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP (Progress)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IProgress)
- COM_INTERFACE_ENTRY2 (IDispatch, IProgress)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IProgress)
END_COM_MAP()
HRESULT FinalConstruct();
diff --git a/src/VBox/Main/include/ProgressProxyImpl.h b/src/VBox/Main/include/ProgressProxyImpl.h
index 0822ff10cf3..b917fa9eb5e 100644
--- a/src/VBox/Main/include/ProgressProxyImpl.h
+++ b/src/VBox/Main/include/ProgressProxyImpl.h
@@ -37,9 +37,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(ProgressProxy)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IProgress)
- COM_INTERFACE_ENTRY2(IDispatch, IProgress)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IProgress)
END_COM_MAP()
HRESULT FinalConstruct();
diff --git a/src/VBox/Main/include/RemoteUSBDeviceImpl.h b/src/VBox/Main/include/RemoteUSBDeviceImpl.h
index 03b2ce55dfe..fced75d3063 100644
--- a/src/VBox/Main/include/RemoteUSBDeviceImpl.h
+++ b/src/VBox/Main/include/RemoteUSBDeviceImpl.h
@@ -39,10 +39,8 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP (RemoteUSBDevice)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
COM_INTERFACE_ENTRY (IHostUSBDevice)
- COM_INTERFACE_ENTRY (IUSBDevice)
- COM_INTERFACE_ENTRY2 (IDispatch, IUSBDevice)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IUSBDevice)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (RemoteUSBDevice)
diff --git a/src/VBox/Main/include/SerialPortImpl.h b/src/VBox/Main/include/SerialPortImpl.h
index 45551009261..097449f9f7a 100644
--- a/src/VBox/Main/include/SerialPortImpl.h
+++ b/src/VBox/Main/include/SerialPortImpl.h
@@ -41,9 +41,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(SerialPort)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (ISerialPort)
- COM_INTERFACE_ENTRY2 (IDispatch, ISerialPort)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (ISerialPort)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (SerialPort)
diff --git a/src/VBox/Main/include/SessionImpl.h b/src/VBox/Main/include/SessionImpl.h
index cf82f5948d5..2fb4d9affe9 100644
--- a/src/VBox/Main/include/SessionImpl.h
+++ b/src/VBox/Main/include/SessionImpl.h
@@ -33,6 +33,9 @@
# define VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
#endif
+#ifdef RT_OS_WINDOWS
+[threading(free)]
+#endif
class ATL_NO_VTABLE Session :
public VirtualBoxBase,
VBOX_SCRIPTABLE_IMPL(ISession),
@@ -53,11 +56,9 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Session)
- COM_INTERFACE_ENTRY2(IDispatch, ISession)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(ISession)
COM_INTERFACE_ENTRY2(IDispatch, IInternalSessionControl)
COM_INTERFACE_ENTRY(IInternalSessionControl)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(ISession)
END_COM_MAP()
HRESULT FinalConstruct();
diff --git a/src/VBox/Main/include/SharedFolderImpl.h b/src/VBox/Main/include/SharedFolderImpl.h
index c5b51b477d6..f058162a77d 100644
--- a/src/VBox/Main/include/SharedFolderImpl.h
+++ b/src/VBox/Main/include/SharedFolderImpl.h
@@ -47,9 +47,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(SharedFolder)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (ISharedFolder)
- COM_INTERFACE_ENTRY2 (IDispatch, ISharedFolder)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (ISharedFolder)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
diff --git a/src/VBox/Main/include/SnapshotImpl.h b/src/VBox/Main/include/SnapshotImpl.h
index 303e6436f64..d55ca45aa47 100644
--- a/src/VBox/Main/include/SnapshotImpl.h
+++ b/src/VBox/Main/include/SnapshotImpl.h
@@ -43,9 +43,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Snapshot)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (ISnapshot)
- COM_INTERFACE_ENTRY2 (IDispatch, ISnapshot)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (ISnapshot)
END_COM_MAP()
Snapshot()
diff --git a/src/VBox/Main/include/StorageControllerImpl.h b/src/VBox/Main/include/StorageControllerImpl.h
index d51febb6381..c3f616650b0 100644
--- a/src/VBox/Main/include/StorageControllerImpl.h
+++ b/src/VBox/Main/include/StorageControllerImpl.h
@@ -35,9 +35,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(StorageController)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IStorageController)
- COM_INTERFACE_ENTRY2 (IDispatch, IStorageController)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IStorageController)
END_COM_MAP()
StorageController() { };
diff --git a/src/VBox/Main/include/SystemPropertiesImpl.h b/src/VBox/Main/include/SystemPropertiesImpl.h
index ea7f709c63e..c6442f3881c 100644
--- a/src/VBox/Main/include/SystemPropertiesImpl.h
+++ b/src/VBox/Main/include/SystemPropertiesImpl.h
@@ -45,9 +45,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(SystemProperties)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(ISystemProperties)
- COM_INTERFACE_ENTRY2(IDispatch, ISystemProperties)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (ISystemProperties)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(SystemProperties)
diff --git a/src/VBox/Main/include/USBControllerImpl.h b/src/VBox/Main/include/USBControllerImpl.h
index d57ac2ba91a..91f979bce04 100644
--- a/src/VBox/Main/include/USBControllerImpl.h
+++ b/src/VBox/Main/include/USBControllerImpl.h
@@ -42,9 +42,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(USBController)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IUSBController)
- COM_INTERFACE_ENTRY2 (IDispatch, IUSBController)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IUSBController)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (USBController)
diff --git a/src/VBox/Main/include/USBDeviceFilterImpl.h b/src/VBox/Main/include/USBDeviceFilterImpl.h
index 371884d73b8..6dfdf8d444a 100644
--- a/src/VBox/Main/include/USBDeviceFilterImpl.h
+++ b/src/VBox/Main/include/USBDeviceFilterImpl.h
@@ -73,9 +73,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(USBDeviceFilter)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IUSBDeviceFilter)
- COM_INTERFACE_ENTRY2 (IDispatch, IUSBDeviceFilter)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IUSBDeviceFilter)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (USBDeviceFilter)
@@ -179,10 +177,8 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(HostUSBDeviceFilter)
- COM_INTERFACE_ENTRY(IDispatch)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IUSBDeviceFilter)
- COM_INTERFACE_ENTRY(IHostUSBDeviceFilter)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IHostUSBDeviceFilter)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (HostUSBDeviceFilter)
diff --git a/src/VBox/Main/include/USBDeviceImpl.h b/src/VBox/Main/include/USBDeviceImpl.h
index 5b923f71ace..4de440b9b82 100644
--- a/src/VBox/Main/include/USBDeviceImpl.h
+++ b/src/VBox/Main/include/USBDeviceImpl.h
@@ -38,9 +38,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(OUSBDevice)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IUSBDevice)
- COM_INTERFACE_ENTRY2 (IDispatch, IUSBDevice)
+ VBOX_DEFAULT_INTERFACE_ENTRIES (IUSBDevice)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (OUSBDevice)
diff --git a/src/VBox/Main/include/VFSExplorerImpl.h b/src/VBox/Main/include/VFSExplorerImpl.h
index e10f58ad770..cc850e4197b 100644
--- a/src/VBox/Main/include/VFSExplorerImpl.h
+++ b/src/VBox/Main/include/VFSExplorerImpl.h
@@ -33,16 +33,14 @@ class ATL_NO_VTABLE VFSExplorer :
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(VFSExplorer)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IVFSExplorer)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IVFSExplorer)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(VFSExplorer)
// public initializer/uninitializer for internal purposes only
- HRESULT FinalConstruct() { return S_OK; }
- void FinalRelease() { uninit(); }
+ HRESULT FinalConstruct() { return BaseFinalConstruct(); }
+ void FinalRelease() { uninit(); BaseFinalRelease(); }
HRESULT init(VFSType_T aType, Utf8Str aFilePath, Utf8Str aHostname, Utf8Str aUsername, Utf8Str aPassword, VirtualBox *aVirtualBox);
void uninit();
diff --git a/src/VBox/Main/include/VRDEServerImpl.h b/src/VBox/Main/include/VRDEServerImpl.h
index a1a4a57e802..3fc877e99ac 100644
--- a/src/VBox/Main/include/VRDEServerImpl.h
+++ b/src/VBox/Main/include/VRDEServerImpl.h
@@ -50,9 +50,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(VRDEServer)
- COM_INTERFACE_ENTRY (ISupportErrorInfo)
- COM_INTERFACE_ENTRY (IVRDEServer)
- COM_INTERFACE_ENTRY2 (IDispatch, IVRDEServer)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IVRDEServer)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR (VRDEServer)
diff --git a/src/VBox/Main/include/VirtualBoxBase.h b/src/VBox/Main/include/VirtualBoxBase.h
index 92c60d17c72..1f0a64b64cd 100644
--- a/src/VBox/Main/include/VirtualBoxBase.h
+++ b/src/VBox/Main/include/VirtualBoxBase.h
@@ -637,6 +637,29 @@ class ATL_NO_VTABLE VirtualBoxBase
, public ISupportErrorInfo
#endif
{
+protected:
+#ifdef RT_OS_WINDOWS
+ CComPtr <IUnknown> m_pUnkMarshaler;
+#endif
+
+ HRESULT BaseFinalConstruct()
+ {
+#ifdef RT_OS_WINDOWS
+ return CoCreateFreeThreadedMarshaler(this, //GetControllingUnknown(),
+ &m_pUnkMarshaler.p);
+#else
+ return S_OK;
+#endif
+ }
+
+ void BaseFinalRelease()
+ {
+#ifdef RT_OS_WINDOWS
+ m_pUnkMarshaler.Release();
+#endif
+ }
+
+
public:
enum State { NotReady, Ready, InInit, InUninit, InitFailed, Limited };
diff --git a/src/VBox/Main/include/VirtualBoxClientImpl.h b/src/VBox/Main/include/VirtualBoxClientImpl.h
index e94db28d3f8..65c61148476 100644
--- a/src/VBox/Main/include/VirtualBoxClientImpl.h
+++ b/src/VBox/Main/include/VirtualBoxClientImpl.h
@@ -45,9 +45,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(VirtualBoxClient)
- COM_INTERFACE_ENTRY2(IDispatch, IVirtualBoxClient)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IVirtualBoxClient)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IVirtualBoxClient)
END_COM_MAP()
HRESULT FinalConstruct();
diff --git a/src/VBox/Main/include/VirtualBoxImpl.h b/src/VBox/Main/include/VirtualBoxImpl.h
index 4a2f5234eb6..adb080d9b06 100644
--- a/src/VBox/Main/include/VirtualBoxImpl.h
+++ b/src/VBox/Main/include/VirtualBoxImpl.h
@@ -56,7 +56,6 @@ namespace settings
class MainConfigFile;
struct MediaRegistry;
}
-
class ATL_NO_VTABLE VirtualBox :
public VirtualBoxBase,
VBOX_SCRIPTABLE_IMPL(IVirtualBox)
@@ -82,9 +81,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(VirtualBox)
- COM_INTERFACE_ENTRY2(IDispatch, IVirtualBox)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IVirtualBox)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IVirtualBox)
END_COM_MAP()
// to postpone generation of the default ctor/dtor
diff --git a/src/VBox/Main/src-all/EventImpl.cpp b/src/VBox/Main/src-all/EventImpl.cpp
index c96abefeeba..58422b880d3 100644
--- a/src/VBox/Main/src-all/EventImpl.cpp
+++ b/src/VBox/Main/src-all/EventImpl.cpp
@@ -85,7 +85,7 @@ struct VBoxEvent::Data
HRESULT VBoxEvent::FinalConstruct()
{
m = new Data;
- return S_OK;
+ return BaseFinalConstruct();
}
void VBoxEvent::FinalRelease()
@@ -95,6 +95,7 @@ void VBoxEvent::FinalRelease()
uninit();
delete m;
m = 0;
+ BaseFinalRelease();
}
}
@@ -910,13 +911,14 @@ EventSource::~EventSource()
HRESULT EventSource::FinalConstruct()
{
m = new Data;
- return S_OK;
+ return BaseFinalConstruct();
}
void EventSource::FinalRelease()
{
uninit();
delete m;
+ BaseFinalRelease();
}
HRESULT EventSource::init(IUnknown *)
@@ -1183,9 +1185,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(PassiveEventListener)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IEventListener)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IEventListener)
END_COM_MAP()
PassiveEventListener()
@@ -1195,10 +1195,12 @@ public:
HRESULT FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void FinalRelease()
- {}
+ {
+ BaseFinalRelease();
+ }
// IEventListener methods
STDMETHOD(HandleEvent)(IEvent *)
@@ -1223,9 +1225,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(ProxyEventListener)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IEventListener)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IEventListener)
END_COM_MAP()
ProxyEventListener()
@@ -1235,10 +1235,12 @@ public:
HRESULT FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void FinalRelease()
- {}
+ {
+ BaseFinalRelease();
+ }
HRESULT init(IEventSource* aSource)
{
@@ -1278,9 +1280,7 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(EventSourceAggregator)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- COM_INTERFACE_ENTRY(IEventSource)
- COM_INTERFACE_ENTRY(IDispatch)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IEventSource)
END_COM_MAP()
EventSourceAggregator()
@@ -1290,13 +1290,14 @@ public:
HRESULT FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void FinalRelease()
{
mEventSources.clear();
mListenerProxies.clear();
mSource->uninit();
+ BaseFinalRelease();
}
// internal public
diff --git a/src/VBox/Main/src-all/ExtPackManagerImpl.cpp b/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
index 2e54105a6f1..2bbebd7fff7 100644
--- a/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
+++ b/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
@@ -211,7 +211,7 @@ DEFINE_EMPTY_CTOR_DTOR(ExtPackFile)
HRESULT ExtPackFile::FinalConstruct()
{
m = NULL;
- return S_OK;
+ return BaseFinalConstruct();
}
/**
@@ -330,6 +330,7 @@ HRESULT ExtPackFile::initFailed(const char *a_pszWhyFmt, ...)
void ExtPackFile::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
/**
diff --git a/src/VBox/Main/src-all/PciDeviceAttachmentImpl.cpp b/src/VBox/Main/src-all/PciDeviceAttachmentImpl.cpp
index bd2735c52ba..390c36eea61 100644
--- a/src/VBox/Main/src-all/PciDeviceAttachmentImpl.cpp
+++ b/src/VBox/Main/src-all/PciDeviceAttachmentImpl.cpp
@@ -49,13 +49,14 @@ struct PciDeviceAttachment::Data
HRESULT PciDeviceAttachment::FinalConstruct()
{
LogFlowThisFunc(("\n"));
- return S_OK;
+ return BaseFinalConstruct();
}
void PciDeviceAttachment::FinalRelease()
{
LogFlowThisFunc(("\n"));
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-all/ProgressImpl.cpp b/src/VBox/Main/src-all/ProgressImpl.cpp
index 1d700cfea42..54cc3688f7c 100644
--- a/src/VBox/Main/src-all/ProgressImpl.cpp
+++ b/src/VBox/Main/src-all/ProgressImpl.cpp
@@ -81,7 +81,7 @@ HRESULT ProgressBase::FinalConstruct()
m_pfnCancelCallback = NULL;
m_pvCancelUserArg = NULL;
- return S_OK;
+ return BaseFinalConstruct();
}
// protected initializer/uninitializer for internal purposes only
@@ -592,6 +592,7 @@ HRESULT Progress::FinalConstruct()
void Progress::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
@@ -1243,12 +1244,13 @@ HRESULT CombinedProgress::FinalConstruct()
mProgress = 0;
mCompletedOperations = 0;
- return S_OK;
+ return BaseFinalConstruct();
}
void CombinedProgress::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-all/SharedFolderImpl.cpp b/src/VBox/Main/src-all/SharedFolderImpl.cpp
index fa5cf21d90e..58123e47bda 100644
--- a/src/VBox/Main/src-all/SharedFolderImpl.cpp
+++ b/src/VBox/Main/src-all/SharedFolderImpl.cpp
@@ -44,12 +44,13 @@ SharedFolder::~SharedFolder()
HRESULT SharedFolder::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void SharedFolder::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-client/ConsoleImpl.cpp b/src/VBox/Main/src-client/ConsoleImpl.cpp
index 6bfdedd035a..7a71da8ba2c 100644
--- a/src/VBox/Main/src-client/ConsoleImpl.cpp
+++ b/src/VBox/Main/src-client/ConsoleImpl.cpp
@@ -378,7 +378,7 @@ HRESULT Console::FinalConstruct()
*(Console **)(pVmm2UserMethods + 1) = this; /* lazy bird. */
mpVmm2UserMethods = pVmm2UserMethods;
- return S_OK;
+ return BaseFinalConstruct();
}
void Console::FinalRelease()
@@ -386,6 +386,8 @@ void Console::FinalRelease()
LogFlowThisFunc(("\n"));
uninit();
+
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
@@ -485,10 +487,10 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl)
ComPtr<IEventSource> pES;
rc = pVirtualBox->COMGETTER(EventSource)(pES.asOutParam());
AssertComRC(rc);
- mVmListner = new VmEventListenerImpl(this);
+ mVmListener = new VmEventListenerImpl(this);
com::SafeArray<VBoxEventType_T> eventTypes;
eventTypes.push_back(VBoxEventType_OnNATRedirect);
- rc = pES->RegisterListener(mVmListner, ComSafeArrayAsInParam(eventTypes), true);
+ rc = pES->RegisterListener(mVmListener, ComSafeArrayAsInParam(eventTypes), true);
AssertComRC(rc);
}
@@ -524,7 +526,7 @@ void Console::uninit()
}
LogFlowThisFunc(("initFailed()=%d\n", autoUninitSpan.initFailed()));
- if (mVmListner)
+ if (mVmListener)
{
ComPtr<IEventSource> pES;
ComPtr<IVirtualBox> pVirtualBox;
@@ -536,11 +538,14 @@ void Console::uninit()
AssertComRC(rc);
if (!pES.isNull())
{
- rc = pES->UnregisterListener(mVmListner);
- AssertComRC(rc);
+ rc = pES->UnregisterListener(mVmListener);
+ // XXX: for some reasons we're getting VBOX_E_OBJECT_NOT_FOUND
+ // here - investigate
+ //AssertComRC(rc);
}
}
- mVmListner->Release();
+ mVmListener->Release();
+ mVmListener = 0;
}
/* power down the VM if necessary */
diff --git a/src/VBox/Main/src-client/ConsoleVRDPServer.cpp b/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
index 9a3c8f5fb43..887797110e5 100644
--- a/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
+++ b/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
@@ -2410,12 +2410,13 @@ VRDEServerInfo::~VRDEServerInfo()
HRESULT VRDEServerInfo::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void VRDEServerInfo::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public methods only for internal purposes
diff --git a/src/VBox/Main/src-client/DisplayImpl.cpp b/src/VBox/Main/src-client/DisplayImpl.cpp
index 037d2b40289..7c505aed9dd 100644
--- a/src/VBox/Main/src-client/DisplayImpl.cpp
+++ b/src/VBox/Main/src-client/DisplayImpl.cpp
@@ -123,7 +123,7 @@ HRESULT Display::FinalConstruct()
mu32UpdateVBVAFlags = 0;
#endif
- return S_OK;
+ return BaseFinalConstruct();
}
void Display::FinalRelease()
@@ -135,6 +135,7 @@ void Display::FinalRelease()
RTCritSectDelete (&mVBVALock);
memset (&mVBVALock, 0, sizeof (mVBVALock));
}
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-client/GuestImpl.cpp b/src/VBox/Main/src-client/GuestImpl.cpp
index cd473e9e22e..3c3e0f5a9e2 100644
--- a/src/VBox/Main/src-client/GuestImpl.cpp
+++ b/src/VBox/Main/src-client/GuestImpl.cpp
@@ -43,12 +43,13 @@ DEFINE_EMPTY_CTOR_DTOR (Guest)
HRESULT Guest::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void Guest::FinalRelease()
{
uninit ();
+ BaseFinalRelease();
}
// public methods only for internal purposes
diff --git a/src/VBox/Main/src-client/KeyboardImpl.cpp b/src/VBox/Main/src-client/KeyboardImpl.cpp
index 4f126c0e212..a12d8435d1f 100644
--- a/src/VBox/Main/src-client/KeyboardImpl.cpp
+++ b/src/VBox/Main/src-client/KeyboardImpl.cpp
@@ -81,12 +81,13 @@ HRESULT Keyboard::FinalConstruct()
RT_ZERO(mpDrv);
mpVMMDev = NULL;
mfVMMDevInited = false;
- return S_OK;
+ return BaseFinalConstruct();
}
void Keyboard::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public methods
diff --git a/src/VBox/Main/src-client/MachineDebuggerImpl.cpp b/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
index 6871abdde7d..c1d92da3c3c 100644
--- a/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
+++ b/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
@@ -55,12 +55,13 @@ MachineDebugger::~MachineDebugger()
HRESULT MachineDebugger::FinalConstruct()
{
unconst(mParent) = NULL;
- return S_OK;
+ return BaseFinalConstruct();
}
void MachineDebugger::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-client/MouseImpl.cpp b/src/VBox/Main/src-client/MouseImpl.cpp
index a72b168826e..e9b696fcf48 100644
--- a/src/VBox/Main/src-client/MouseImpl.cpp
+++ b/src/VBox/Main/src-client/MouseImpl.cpp
@@ -78,12 +78,13 @@ HRESULT Mouse::FinalConstruct()
mcLastAbsY = 0x8000;
mfLastButtons = 0;
mfVMMDevGuestCaps = 0;
- return S_OK;
+ return BaseFinalConstruct();
}
void Mouse::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public methods only for internal purposes
diff --git a/src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp b/src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp
index 37fb20c0828..139669420b7 100644
--- a/src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp
+++ b/src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp
@@ -37,12 +37,13 @@ DEFINE_EMPTY_CTOR_DTOR (RemoteUSBDevice)
HRESULT RemoteUSBDevice::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void RemoteUSBDevice::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-client/SessionImpl.cpp b/src/VBox/Main/src-client/SessionImpl.cpp
index 58b29cfe18d..948557501fd 100644
--- a/src/VBox/Main/src-client/SessionImpl.cpp
+++ b/src/VBox/Main/src-client/SessionImpl.cpp
@@ -56,7 +56,11 @@ HRESULT Session::FinalConstruct()
{
LogFlowThisFunc(("\n"));
- return init();
+ HRESULT rc = init();
+
+ BaseFinalConstruct();
+
+ return rc;
}
void Session::FinalRelease()
@@ -64,6 +68,8 @@ void Session::FinalRelease()
LogFlowThisFunc(("\n"));
uninit();
+
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
@@ -181,9 +187,9 @@ STDMETHODIMP Session::COMGETTER(Machine)(IMachine **aMachine)
HRESULT rc;
if (mConsole)
- rc = mConsole->machine().queryInterfaceTo(aMachine);
+ rc = mConsole->machine().queryInterfaceTo(aMachine);
else
- rc = mRemoteMachine.queryInterfaceTo(aMachine);
+ rc = mRemoteMachine.queryInterfaceTo(aMachine);
if (FAILED(rc))
{
/** @todo VBox 3.3: replace E_FAIL with rc here. */
@@ -214,6 +220,7 @@ STDMETHODIMP Session::COMGETTER(Console)(IConsole **aConsole)
rc = mConsole.queryInterfaceTo(aConsole);
else
rc = mRemoteConsole.queryInterfaceTo(aConsole);
+
if (FAILED(rc))
{
/** @todo VBox 3.3: replace E_FAIL with rc here. */
diff --git a/src/VBox/Main/src-client/USBDeviceImpl.cpp b/src/VBox/Main/src-client/USBDeviceImpl.cpp
index 510ba5c0933..e688a2a0472 100644
--- a/src/VBox/Main/src-client/USBDeviceImpl.cpp
+++ b/src/VBox/Main/src-client/USBDeviceImpl.cpp
@@ -29,12 +29,13 @@ DEFINE_EMPTY_CTOR_DTOR (OUSBDevice)
HRESULT OUSBDevice::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void OUSBDevice::FinalRelease()
{
uninit ();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp b/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp
index b86730a9e08..ac940f25cb5 100644
--- a/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp
+++ b/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp
@@ -41,12 +41,15 @@ uint32_t VirtualBoxClient::g_cInstances = 0;
HRESULT VirtualBoxClient::FinalConstruct()
{
- return init();
+ HRESULT rc = init();
+ BaseFinalConstruct();
+ return rc;
}
void VirtualBoxClient::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/AudioAdapterImpl.cpp b/src/VBox/Main/src-server/AudioAdapterImpl.cpp
index 02f5b69edb3..9b6dbf178a8 100644
--- a/src/VBox/Main/src-server/AudioAdapterImpl.cpp
+++ b/src/VBox/Main/src-server/AudioAdapterImpl.cpp
@@ -40,12 +40,13 @@ AudioAdapter::~AudioAdapter()
HRESULT AudioAdapter::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void AudioAdapter::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/BIOSSettingsImpl.cpp b/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
index 1484cad899e..bc40820ba82 100644
--- a/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
+++ b/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
@@ -50,12 +50,13 @@ struct BIOSSettings::Data
HRESULT BIOSSettings::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void BIOSSettings::FinalRelease()
{
uninit ();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/BandwidthControlImpl.cpp b/src/VBox/Main/src-server/BandwidthControlImpl.cpp
index 18d42ad29ba..927a8007a60 100644
--- a/src/VBox/Main/src-server/BandwidthControlImpl.cpp
+++ b/src/VBox/Main/src-server/BandwidthControlImpl.cpp
@@ -55,12 +55,13 @@ struct BandwidthControl::Data
HRESULT BandwidthControl::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void BandwidthControl::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/BandwidthGroupImpl.cpp b/src/VBox/Main/src-server/BandwidthGroupImpl.cpp
index 88725d7fbf4..b5dd1087c30 100644
--- a/src/VBox/Main/src-server/BandwidthGroupImpl.cpp
+++ b/src/VBox/Main/src-server/BandwidthGroupImpl.cpp
@@ -63,12 +63,13 @@ struct BandwidthGroup::Data
HRESULT BandwidthGroup::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void BandwidthGroup::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/DHCPServerImpl.cpp b/src/VBox/Main/src-server/DHCPServerImpl.cpp
index a31b154d080..60efccc3abc 100644
--- a/src/VBox/Main/src-server/DHCPServerImpl.cpp
+++ b/src/VBox/Main/src-server/DHCPServerImpl.cpp
@@ -42,12 +42,14 @@ DHCPServer::~DHCPServer()
HRESULT DHCPServer::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void DHCPServer::FinalRelease()
{
uninit ();
+
+ BaseFinalRelease();
}
void DHCPServer::uninit()
diff --git a/src/VBox/Main/src-server/GuestOSTypeImpl.cpp b/src/VBox/Main/src-server/GuestOSTypeImpl.cpp
index 50f18fabd58..2f63b72c7b3 100644
--- a/src/VBox/Main/src-server/GuestOSTypeImpl.cpp
+++ b/src/VBox/Main/src-server/GuestOSTypeImpl.cpp
@@ -45,12 +45,14 @@ GuestOSType::~GuestOSType()
HRESULT GuestOSType::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void GuestOSType::FinalRelease()
{
uninit();
+
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/HostImpl.cpp b/src/VBox/Main/src-server/HostImpl.cpp
index 37eed71cf2b..2276731bb72 100644
--- a/src/VBox/Main/src-server/HostImpl.cpp
+++ b/src/VBox/Main/src-server/HostImpl.cpp
@@ -220,12 +220,13 @@ struct Host::Data
HRESULT Host::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void Host::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
/**
diff --git a/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp b/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp
index f9b88578492..98f14b3b3eb 100644
--- a/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp
+++ b/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp
@@ -42,12 +42,13 @@ HostNetworkInterface::~HostNetworkInterface()
HRESULT HostNetworkInterface::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void HostNetworkInterface::FinalRelease()
{
uninit ();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp b/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
index 17c8b9fe458..b4db99db328 100644
--- a/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
+++ b/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
@@ -39,12 +39,13 @@ HRESULT HostUSBDevice::FinalConstruct()
mUSBProxyService = NULL;
mUsb = NULL;
- return S_OK;
+ return BaseFinalConstruct();
}
void HostUSBDevice::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/MachineImpl.cpp b/src/VBox/Main/src-server/MachineImpl.cpp
index 69e9ba24aa2..27007f5f50b 100644
--- a/src/VBox/Main/src-server/MachineImpl.cpp
+++ b/src/VBox/Main/src-server/MachineImpl.cpp
@@ -234,13 +234,14 @@ Machine::~Machine()
HRESULT Machine::FinalConstruct()
{
LogFlowThisFunc(("\n"));
- return S_OK;
+ return BaseFinalConstruct();
}
void Machine::FinalRelease()
{
LogFlowThisFunc(("\n"));
uninit();
+ BaseFinalRelease();
}
/**
@@ -9943,7 +9944,7 @@ HRESULT SessionMachine::FinalConstruct()
# error "Port me!"
#endif
- return S_OK;
+ return BaseFinalConstruct();
}
void SessionMachine::FinalRelease()
@@ -9951,6 +9952,8 @@ void SessionMachine::FinalRelease()
LogFlowThisFunc(("\n"));
uninit(Uninit::Unexpected);
+
+ BaseFinalRelease();
}
/**
diff --git a/src/VBox/Main/src-server/MediumAttachmentImpl.cpp b/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
index 0ecad328401..706189148e8 100644
--- a/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
+++ b/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
@@ -77,13 +77,14 @@ struct MediumAttachment::Data
HRESULT MediumAttachment::FinalConstruct()
{
LogFlowThisFunc(("\n"));
- return S_OK;
+ return BaseFinalConstruct();
}
void MediumAttachment::FinalRelease()
{
LogFlowThisFuncEnter();
uninit();
+ BaseFinalRelease();
LogFlowThisFuncLeave();
}
diff --git a/src/VBox/Main/src-server/MediumFormatImpl.cpp b/src/VBox/Main/src-server/MediumFormatImpl.cpp
index a9998d97890..db57fb7f5a9 100644
--- a/src/VBox/Main/src-server/MediumFormatImpl.cpp
+++ b/src/VBox/Main/src-server/MediumFormatImpl.cpp
@@ -31,12 +31,14 @@ DEFINE_EMPTY_CTOR_DTOR(MediumFormat)
HRESULT MediumFormat::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void MediumFormat::FinalRelease()
{
uninit();
+
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/MediumImpl.cpp b/src/VBox/Main/src-server/MediumImpl.cpp
index ea0173c2b3a..226554e4320 100644
--- a/src/VBox/Main/src-server/MediumImpl.cpp
+++ b/src/VBox/Main/src-server/MediumImpl.cpp
@@ -896,7 +896,7 @@ HRESULT Medium::FinalConstruct()
vrc = RTSemEventMultiSignal(m->queryInfoSem);
AssertRCReturn(vrc, E_FAIL);
- return S_OK;
+ return BaseFinalConstruct();
}
void Medium::FinalRelease()
@@ -904,6 +904,8 @@ void Medium::FinalRelease()
uninit();
delete m;
+
+ BaseFinalRelease();
}
/**
diff --git a/src/VBox/Main/src-server/NATEngineImpl.cpp b/src/VBox/Main/src-server/NATEngineImpl.cpp
index 41131d62736..29d137921d9 100644
--- a/src/VBox/Main/src-server/NATEngineImpl.cpp
+++ b/src/VBox/Main/src-server/NATEngineImpl.cpp
@@ -100,13 +100,14 @@ HRESULT NATEngine::initCopy (Machine *aParent, INetworkAdapter *aAdapter, NATEng
unconst(mAdapter) = aAdapter;
unconst(mParent) = aParent;
autoInitSpan.setSucceeded();
- return S_OK;
+ return BaseFinalConstruct();
}
void NATEngine::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
void NATEngine::uninit()
diff --git a/src/VBox/Main/src-server/NetworkAdapterImpl.cpp b/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
index e1cac005fd7..47a40a32c82 100644
--- a/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
+++ b/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
@@ -45,12 +45,13 @@ NetworkAdapter::~NetworkAdapter()
HRESULT NetworkAdapter::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void NetworkAdapter::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/ParallelPortImpl.cpp b/src/VBox/Main/src-server/ParallelPortImpl.cpp
index 0bdcba66eb2..e7791a6ecf4 100644
--- a/src/VBox/Main/src-server/ParallelPortImpl.cpp
+++ b/src/VBox/Main/src-server/ParallelPortImpl.cpp
@@ -54,12 +54,13 @@ struct ParallelPort::Data
HRESULT ParallelPort::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void ParallelPort::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/PerformanceImpl.cpp b/src/VBox/Main/src-server/PerformanceImpl.cpp
index d934aa6d492..a2c3abd3b3a 100644
--- a/src/VBox/Main/src-server/PerformanceImpl.cpp
+++ b/src/VBox/Main/src-server/PerformanceImpl.cpp
@@ -132,12 +132,13 @@ HRESULT PerformanceCollector::FinalConstruct()
{
LogFlowThisFunc(("\n"));
- return S_OK;
+ return BaseFinalConstruct();
}
void PerformanceCollector::FinalRelease()
{
LogFlowThisFunc(("\n"));
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
@@ -646,7 +647,7 @@ HRESULT PerformanceMetric::FinalConstruct()
{
LogFlowThisFunc(("\n"));
- return S_OK;
+ return BaseFinalConstruct();
}
void PerformanceMetric::FinalRelease()
@@ -654,6 +655,8 @@ void PerformanceMetric::FinalRelease()
LogFlowThisFunc(("\n"));
uninit ();
+
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/ProgressProxyImpl.cpp b/src/VBox/Main/src-server/ProgressProxyImpl.cpp
index b640188f26c..e7742c3c824 100644
--- a/src/VBox/Main/src-server/ProgressProxyImpl.cpp
+++ b/src/VBox/Main/src-server/ProgressProxyImpl.cpp
@@ -134,6 +134,8 @@ void ProgressProxy::FinalRelease()
muOtherProgressStartWeight = 0;
muOtherProgressWeight = 0;
muOtherProgressStartOperation = 0;
+
+ BaseFinalRelease();
}
void ProgressProxy::uninit()
diff --git a/src/VBox/Main/src-server/SerialPortImpl.cpp b/src/VBox/Main/src-server/SerialPortImpl.cpp
index f1d43ce92e2..81234c490a7 100644
--- a/src/VBox/Main/src-server/SerialPortImpl.cpp
+++ b/src/VBox/Main/src-server/SerialPortImpl.cpp
@@ -57,12 +57,13 @@ DEFINE_EMPTY_CTOR_DTOR (SerialPort)
HRESULT SerialPort::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void SerialPort::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/SnapshotImpl.cpp b/src/VBox/Main/src-server/SnapshotImpl.cpp
index 3dd2932d987..c0da30f8d86 100644
--- a/src/VBox/Main/src-server/SnapshotImpl.cpp
+++ b/src/VBox/Main/src-server/SnapshotImpl.cpp
@@ -108,13 +108,14 @@ struct Snapshot::Data
HRESULT Snapshot::FinalConstruct()
{
LogFlowThisFunc(("\n"));
- return S_OK;
+ return BaseFinalConstruct();
}
void Snapshot::FinalRelease()
{
LogFlowThisFunc(("\n"));
uninit();
+ BaseFinalRelease();
}
/**
@@ -888,7 +889,7 @@ HRESULT SnapshotMachine::FinalConstruct()
{
LogFlowThisFunc(("\n"));
- return S_OK;
+ return BaseFinalConstruct();
}
void SnapshotMachine::FinalRelease()
@@ -896,6 +897,8 @@ void SnapshotMachine::FinalRelease()
LogFlowThisFunc(("\n"));
uninit();
+
+ BaseFinalRelease();
}
/**
diff --git a/src/VBox/Main/src-server/StorageControllerImpl.cpp b/src/VBox/Main/src-server/StorageControllerImpl.cpp
index 1fcf71e0c48..1a536019718 100644
--- a/src/VBox/Main/src-server/StorageControllerImpl.cpp
+++ b/src/VBox/Main/src-server/StorageControllerImpl.cpp
@@ -104,12 +104,13 @@ struct StorageController::Data
HRESULT StorageController::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void StorageController::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/SystemPropertiesImpl.cpp b/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
index a79bad6b41c..fecb977fe74 100644
--- a/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
+++ b/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
@@ -61,12 +61,13 @@ SystemProperties::~SystemProperties()
HRESULT SystemProperties::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void SystemProperties::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public methods only for internal purposes
diff --git a/src/VBox/Main/src-server/USBControllerImpl.cpp b/src/VBox/Main/src-server/USBControllerImpl.cpp
index 86e487d2552..517a3123eb9 100644
--- a/src/VBox/Main/src-server/USBControllerImpl.cpp
+++ b/src/VBox/Main/src-server/USBControllerImpl.cpp
@@ -89,12 +89,13 @@ DEFINE_EMPTY_CTOR_DTOR (USBController)
HRESULT USBController::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void USBController::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp b/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp
index 150652bb108..160276c3793 100644
--- a/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp
+++ b/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp
@@ -186,12 +186,13 @@ USBDeviceFilter::~USBDeviceFilter()
HRESULT USBDeviceFilter::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void USBDeviceFilter::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/VRDEServerImpl.cpp b/src/VBox/Main/src-server/VRDEServerImpl.cpp
index f9645e788c5..c99bb83e2de 100644
--- a/src/VBox/Main/src-server/VRDEServerImpl.cpp
+++ b/src/VBox/Main/src-server/VRDEServerImpl.cpp
@@ -55,12 +55,13 @@ VRDEServer::~VRDEServer()
HRESULT VRDEServer::FinalConstruct()
{
- return S_OK;
+ return BaseFinalConstruct();
}
void VRDEServer::FinalRelease()
{
uninit();
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only
diff --git a/src/VBox/Main/src-server/VirtualBoxImpl.cpp b/src/VBox/Main/src-server/VirtualBoxImpl.cpp
index 7ad90640317..3153f8a7e78 100644
--- a/src/VBox/Main/src-server/VirtualBoxImpl.cpp
+++ b/src/VBox/Main/src-server/VirtualBoxImpl.cpp
@@ -343,7 +343,11 @@ HRESULT VirtualBox::FinalConstruct()
{
LogFlowThisFunc(("\n"));
- return init();
+ HRESULT rc = init();
+
+ BaseFinalConstruct();
+
+ return rc;
}
void VirtualBox::FinalRelease()
@@ -351,6 +355,8 @@ void VirtualBox::FinalRelease()
LogFlowThisFunc(("\n"));
uninit();
+
+ BaseFinalRelease();
}
// public initializer/uninitializer for internal purposes only