From 102d43358c06e92add275baaa1c65874f8873cce Mon Sep 17 00:00:00 2001 From: Mindaugas Kavaliauskas Date: Tue, 16 Jun 2009 21:10:31 +0000 Subject: [PATCH] 2009-06-17 00:05 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/contrib/hbwin/axcore.c ! fixed GPF on ActiveX application exit caused by invalid AtlAxWinTerm() call. ; It's inline function and it does not exists in atl.dll ; MSDN says: When Do I Need to Call AtlAxWinTerm? AtlAxWinTerm unregisters the "AtlAxWin7" window class. You should call this function... If don't call this function, the window class will be unregistered automatically when the process terminates. ; Thanks Toninho for self contained 3 lines GPF sample without FWH, gtwvg, etc! --- harbour/ChangeLog | 14 ++++++++++++++ harbour/contrib/hbwin/axcore.c | 9 ++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a5199911c2..4c722797ed 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,20 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-06-17 00:05 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) + * harbour/contrib/hbwin/axcore.c + ! fixed GPF on ActiveX application exit caused by invalid + AtlAxWinTerm() call. + ; It's inline function and it does not exists in atl.dll + ; MSDN says: + When Do I Need to Call AtlAxWinTerm? + + AtlAxWinTerm unregisters the "AtlAxWin7" window class. You should + call this function... If don't call this function, the window class + will be unregistered automatically when the process terminates. + ; Thanks Toninho for self contained 3 lines GPF sample without + FWH, gtwvg, etc! + 2009-06-16 18:39 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * include/hbextern.ch + Added HB_WAEVAL(). diff --git a/harbour/contrib/hbwin/axcore.c b/harbour/contrib/hbwin/axcore.c index b30eac3a2b..6cecfea527 100644 --- a/harbour/contrib/hbwin/axcore.c +++ b/harbour/contrib/hbwin/axcore.c @@ -60,12 +60,10 @@ #endif typedef BOOL ( CALLBACK * PHB_AX_WININIT )( void ); -typedef BOOL ( CALLBACK * PHB_AX_WINTERM )( void ); typedef HRESULT ( CALLBACK * PHB_AX_GETCTRL )( HWND, IUnknown** ); static HMODULE s_hLib = NULL; -static PHB_AX_WINTERM s_pAtlAxWinTerm = NULL; static PHB_AX_GETCTRL s_pAtlAxGetControl = NULL; @@ -75,10 +73,7 @@ static void hb_ax_exit( void* cargo ) if( s_hLib ) { - ( *s_pAtlAxWinTerm )(); - - s_pAtlAxWinTerm = NULL; - s_pAtlAxWinTerm = NULL; + s_pAtlAxGetControl = NULL; FreeLibrary( s_hLib ); @@ -100,8 +95,8 @@ static int hb_ax_init( void ) return 0; } pAtlAxWinInit = ( PHB_AX_WININIT ) GetProcAddress( s_hLib, HBTEXT( "AtlAxWinInit" ) ); - s_pAtlAxWinTerm = ( PHB_AX_WINTERM ) GetProcAddress( s_hLib, HBTEXT( "AtlAxWinTerm" ) ); s_pAtlAxGetControl = ( PHB_AX_GETCTRL ) GetProcAddress( s_hLib, HBTEXT( "AtlAxGetControl" ) ); + if( pAtlAxWinInit ) ( *pAtlAxWinInit )();