Hello Mindaugas

Mindaugas Kavaliauskas wrote:
> 
>>       NOTE: CPP mode generates a GPF when ole is unloaded due to
>> refcount.
>>             Mindaugas can you fix it.
> 
> I can just repeat myself: can you give self containing sample?
> 

GPF is in my code when I call WVG_AxShutdownConnectionPoint().
I have adopted axcore.c | garbase collection function to release the object.
So I am requesting if you review gtwvg/wvgsink.c and following code:

HB_FUNC( WVG_AXSHUTDOWNCONNECTIONPOINT )
{
   MyRealIEventHandler* pSink = ( MyRealIEventHandler * ) hb_parptr( 1 );

   if( pSink && pSink->pIConnectionPoint )
   {
      HB_VTBL( pSink->pIConnectionPoint )->Unadvise( HB_THIS_(
pSink->pIConnectionPoint ) pSink->dwEventCookie );
      HB_VTBL( pSink->pIConnectionPoint )->Release( HB_THIS(
pSink->pIConnectionPoint ) );
      pSink->pIConnectionPoint = NULL;
      pSink->dwEventCookie = 0;
   }
   if( pSink && pSink->pEvents )
      hb_itemRelease( pSink->pEvents );

   /* in CPP mode following line GPFs on any OLE whose count becomes 0 */
   HB_VTBL( ( IEventHandler* ) pSink )->Release( HB_THIS( ( IEventHandler* )
pSink ) );
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}

In non CPP mode the above code works fine.

You can reproduce it by compiling contrib/gtwvg/tests/demowvg.prg.
Point to <Active-X> menu option and click on first prompt.
After windo is drawn with explorer active-x click the close(X) button.
GPF will appear.

Infact I suspect I am not casting the pointers properly but am unable to 
locate where I am erring.

Regards
Pritpal Bedi

OR better if you implement destructor function in wvgsink.c too.



-- 
View this message in context: 
http://www.nabble.com/SF.net-SVN%3A-harbour-project%3A-11156--trunk-harbour-tp23756543p23763990.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to