dru...@users.sourceforge.net wrote:
Log Message:
-----------
2009-10-23 18:07 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbwin/axcore.c
! fixed wrongly initialized reference counter in AX control.
Now when AX Window is closed and all .prg references to OLE
are cleared pSink is released.
With this code, I do not see the destructor being activated:
#include "hbgtinfo.ch"
#include "hbclass.ch"
REQUEST HB_GT_WVT_DEFAULT
#define WS_CHILD 1073741824
#define WS_VISIBLE 268435456
#define WS_CLIPCHILDREN 33554432
PROCEDURE Main()
LOCAL oMSCAL
WAIT "Make sure we are 'Active Window'"
oMSCAL := HActiveX():Init( WAPI_GetActiveWindow(), "www.google.com", 0, 0,
300, 300 )
WAIT "Press any key to exit"
RETURN
CLASS HActiveX
DATA oOLE
METHOD Init
METHOD Event
ERROR HANDLER OnError
DESTRUCTOR Dtor
ENDCLASS
METHOD Init( hWnd, cProgId, nTop, nLeft, nWidth, nHeight, cID ) CLASS HActiveX
LOCAL nStyle := WS_CHILD + WS_VISIBLE + WS_CLIPCHILDREN
win_AxInit()
hWnd := WAPI_CreateWindowEX( 0, "AtlAxWin", cProgId, nStyle, nLeft, nTop,
nWidth, nHeight, hWnd, 0 )
//::oOLE := WIN_AxGetControl( hWnd, { | event, ... | Event( event, ... ) },
cID )
::oOLE := WIN_AxGetControl( hWnd, { | event, ... | ::Event( event, ... ) },
cID )
RETURN self
PROCEDURE Event( ... ) CLASS HActiveX
LOCAL cEvents := ""
LOCAL aEvents := { ... }
aEval( aEvents, { | xEvent | cEvents += HB_ValToStr( xEvent ) + ", " } )
wapi_OutputDebugString( cEvents )
RETURN
METHOD OnError() CLASS HActiveX
RETURN HB_ExecFromArray( ::oOLE, __GetMessage(), HB_AParams() )
METHOD Dtor() CLASS HActiveX
wapi_OutputDebugString( "Dtor" )
::oOLE := NIL
wapi_OutputDebugString( "After Dtor" )
RETURN NIL
STATIC PROCEDURE Event( ... )
LOCAL cEvents := ""
LOCAL aEvents := { ... }
aEval( aEvents, { | xEvent | cEvents += HB_ValToStr( xEvent ) + ", " } )
wapi_OutputDebugString( cEvents )
RETURN
My understanding of the new garbage collection, was that it should work?
If MSCAL.Calender is substituted it GPF's.
Using the procedure instead of the method procedure works fine, the destructor
is called, and no GPF, and the object need not be explicitly set to NIL.
Regards
Alex
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour