[commit] r1155 - trunk/SDK/BON/Common
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Wed Feb 2 14:21:35 CST 2011
Author: ksmyth
Date: Wed Feb 2 14:21:35 2011
New Revision: 1155
Log:
Release Consoles GMEOLEApp, or we can get a circular ref GME.exe->Interpreter.dll->gmeoleapp and GME.exe never exits. Dont throw exceptions from COM methods.
Modified:
trunk/SDK/BON/Common/ComponentObj.cpp
trunk/SDK/BON/Common/ComponentObj.h
trunk/SDK/BON/Common/Console.h
Modified: trunk/SDK/BON/Common/ComponentObj.cpp
==============================================================================
--- trunk/SDK/BON/Common/ComponentObj.cpp Wed Feb 2 12:09:23 2011 (r1154)
+++ trunk/SDK/BON/Common/ComponentObj.cpp Wed Feb 2 14:21:35 2011 (r1155)
@@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////
// ComponentObj.cpp : implementation file
//
-// In case of standard and simple components, this file does not need tobe modified
+// In case of standard and simple components, this file does not need to be modified
// However, if anything except Component.[cpp,h] or RawComponent.[cpp,h] is to be modified,
// this is the likely and preferred candidate
//////////////////////////////////////////////////////////////////////////////
@@ -97,21 +97,14 @@
#ifdef GME_ADDON
-wchar_t GmeDllDesc[] = L"<GMEDLLDESC> add-on,*," WCHAR(COMPONENT_NAME) L"," WCHAR(COCLASS_PROGID) L"<END>";
#define CETYPE COMPONENTTYPE_ADDON
#else
#ifdef GME_INTERPRETER
-wchar_t GmeDllDesc[] = L"<GMEDLLDESC> interpreter," WCHAR(PARADIGMS) L"," WCHAR(COMPONENT_NAME) L"," WCHAR(COCLASS_PROGID) L"<END>";
#define CETYPE COMPONENTTYPE_INTERPRETER
#else
#error No GME Componenttype (one of GME_ADDON or GME_INTERPRETER) is defined
#endif
#endif
-
-
-#undef WCHAR_L
-#undef WCHAR
-
#ifdef GME_ADDON
/////////////////////////////////////////////////////////////////////////////
// CEventSink
@@ -126,8 +119,6 @@
// object is active, the constructor calls AfxOleLockApp.
AfxOleLockApp();
-
-
}
CEventSink::~CEventSink()
@@ -136,7 +127,6 @@
// with OLE automation, the destructor calls AfxOleUnlockApp.
AfxOleUnlockApp();
- AfxMessageBox( "Destoyed" );
}
BEGIN_MESSAGE_MAP(CEventSink, CCmdTarget)
@@ -165,12 +155,11 @@
CCmdTarget::OnFinalRelease();
}
-#define COMCLASS CEventSink::XComponent
+#define COMCLASS CEventSink::XComponent
#define COMPROLOGUE METHOD_PROLOGUE(CEventSink,Component)
STDMETHODIMP COMCLASS::GlobalEvent(globalevent_enum event) {
COMPROLOGUE;
- // BY PAKA BEGIN
#ifdef BUILDER_OBJECT_NETWORK_V2
try {
pThis->comp->bon2Comp.globalEventPerformed( event );
@@ -185,11 +174,10 @@
#else
return pThis->comp->rawcomp.GlobalEvent(event);
#endif // BUILDER_OBJECT_NETWORK_V2
- // BY PAKA END
}
+
STDMETHODIMP COMCLASS::ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v) {
COMPROLOGUE;
- // BY PAKA BEGIN
#ifdef BUILDER_OBJECT_NETWORK_V2
try {
BON::Object object = BON::Object::attach( obj );
@@ -215,7 +203,6 @@
#else
return pThis->comp->rawcomp.ObjectEvent(obj, eventmask, v);
#endif // BUILDER_OBJECT_NETWORK_V2
- // BY PAKA END
}
STDMETHODIMP_(ULONG) COMCLASS::AddRef()
@@ -262,11 +249,9 @@
#ifdef RAWCOMPONENT_H
rawcomp.interactive = interactive;
#endif // RAWCOMPONENT_H
- // BY PAKA BEGIN
- #ifdef BUILDER_OBJECT_NETWORK_V2
- bon2Comp.m_bIsInteractive = interactive;
- #endif BUILDER_OBJECT_NETWORK_V2
- // BY PAKA END
+#ifdef BUILDER_OBJECT_NETWORK_V2
+ bon2Comp.m_bIsInteractive = interactive;
+#endif // BUILDER_OBJECT_NETWORK_V2
}
void CComponentObj::RegisterActiveObject()
@@ -285,6 +270,7 @@
// with OLE automation, the destructor calls AfxOleUnlockApp.
ASSERT( registeractiveobjectret == 0 );
+ GMEConsole::Console::ReleaseConsole();
AfxOleUnlockApp();
}
@@ -379,6 +365,7 @@
ASSERT( gme != NULL );
+ COMTRY {
long prefs;
COMTHROW(gme->get_Preferences(&prefs));
@@ -387,11 +374,11 @@
CBuilderObjectList objects;
if(psa) {
- MGACOLL_ITERATE(IMgaFCO, psa) {
- CBuilderObject* o = CBuilder::theInstance->FindObject(MGACOLL_ITER);
- ASSERT( o != NULL );
- objects.AddTail(o);
- } MGACOLL_ITERATE_END;
+ MGACOLL_ITERATE(IMgaFCO, psa) {
+ CBuilderObject* o = CBuilder::theInstance->FindObject(MGACOLL_ITER);
+ ASSERT( o != NULL );
+ objects.AddTail(o);
+ } MGACOLL_ITERATE_END;
}
#ifndef DEPRECATED_BON_INVOKE_IMPLEMENTED
@@ -414,6 +401,7 @@
#endif
COMTHROW(gme->put_Preferences(prefs));
+ } COMCATCH(;)
return S_OK;
}
@@ -622,7 +610,7 @@
COMPROLOGUE;
CComVariant vv;
CString bb;
- if(pThis->parmap.Lookup(CString(name), bb)) {
+ if (pThis->parmap.Lookup(CString(name), bb)) {
vv = CComBSTR(bb);
vv.Detach(pVal);
}
@@ -632,14 +620,13 @@
COMPROLOGUE;
CComVariant dest;
HRESULT hr = ::VariantChangeType(&dest, &newVal, VARIANT_NOVALUEPROP, VT_BSTR);
- if(hr == S_OK) pThis->parmap.SetAt(CString(name), CString(dest.bstrVal));
+ if (hr == S_OK) pThis->parmap.SetAt(CString(name), CString(dest.bstrVal));
return hr;
}
#else // BUILDER_OBJECT_NETWORK
-// BY PAKA BEGIN
#ifdef BUILDER_OBJECT_NETWORK_V2
// If BUILDER OBJECT NETWORK 2 IS USED
@@ -676,6 +663,7 @@
COMPROLOGUE;
CPushRoutingFrame temp( NULL ); // hack!!
+ COMTRY {
ASSERT( gme != NULL );
long prefs;
@@ -726,6 +714,7 @@
COMTHROW( gme->AbortTransaction() );
#endif
}
+ } COMCATCH(;)
return S_OK;
}
@@ -737,6 +726,7 @@
ASSERT( gme != NULL );
+ COMTRY {
long prefs;
COMTHROW( gme->get_Preferences( &prefs ) );
COMTHROW( gme->put_Preferences( prefs | MGAPREF_RELAXED_RDATTRTYPES | MGAPREF_RELAXED_WRATTRTYPES ) );
@@ -774,6 +764,7 @@
AfxMessageBox( "Unhandled and unknown exception was thrown in BON2Component ObjectInvokeEx!" );
COMTHROW( gme->AbortTransaction() );
}
+ } COMCATCH(;)
return S_OK;
}
@@ -858,7 +849,6 @@
}
#else
-// BY PAKA END
// If BUILDER OBJECT NETWORK IS NOT USED, THESE METHODS ARE CALLS INTO RawComponent
@@ -952,9 +942,7 @@
return S_OK;
}
-// BY PAKA BEGIN
#endif // BUILDER_OBJECT_NETWORK_V2
-// BY PAKA END
#endif // BUILDER_OBJECT_NETWORK
Modified: trunk/SDK/BON/Common/ComponentObj.h
==============================================================================
--- trunk/SDK/BON/Common/ComponentObj.h Wed Feb 2 12:09:23 2011 (r1154)
+++ trunk/SDK/BON/Common/ComponentObj.h Wed Feb 2 14:21:35 2011 (r1155)
@@ -8,7 +8,6 @@
#include "Exceptions.h"
#include "MgaUtil.h"
-
#if defined(BUILDER_OBJECT_NETWORK)
#else
// BY PAKA BEGIN
@@ -21,14 +20,7 @@
// BY PAKA END
#endif // BUILDER_OBJECT_NETWORK
-
-#if _MSC_VER >= 1000
#pragma once
-#endif // _MSC_VER >= 1000
-// InterpreterObj.h : header file
-//
-
-
class CComponentObj;
@@ -181,7 +173,6 @@
#endif // RAWCOMPONENT_H
-// BY PAKA BEGIN
#ifdef BUILDER_OBJECT_NETWORK_V2
BON::Component bon2Comp;
@@ -191,10 +182,8 @@
#endif // GME_ADDON
#endif // BUILDER_OBJECT_NETWORK_V2
-// BY PAKA END
void HandleError( Util::Exception* pEx );
-
}; // CComponentObj
Modified: trunk/SDK/BON/Common/Console.h
==============================================================================
--- trunk/SDK/BON/Common/Console.h Wed Feb 2 12:09:23 2011 (r1154)
+++ trunk/SDK/BON/Common/Console.h Wed Feb 2 14:21:35 2011 (r1155)
@@ -14,6 +14,10 @@
static CComPtr<IGMEOLEApp> gmeoleapp;
static void SetupConsole(CComPtr<IMgaProject> project);
+ static void ReleaseConsole() {
+ if (gmeoleapp)
+ gmeoleapp.Release();
+ }
static void WriteLine(const CString& message, msgtype_enum type)
{
@@ -37,7 +41,8 @@
static void Clear()
{
if (gmeoleapp != 0) {
- COMTHROW(gmeoleapp->put_ConsoleContents(L""));
+ CComBSTR empty(L"");
+ COMTHROW(gmeoleapp->put_ConsoleContents(empty));
}
}
@@ -82,10 +87,15 @@
class Info
{
public:
+ // deprecated
static void writeLine(const CString& message)
{
Console::WriteLine(message,MSG_INFO);
}
+ static void WriteLine(const CString& message)
+ {
+ Console::WriteLine(message,MSG_INFO);
+ }
};
};
}
\ No newline at end of file
More information about the gme-commit
mailing list