On Mon, 07 Sep 2009, Alex Strickland wrote:

Hi,

> Do you think it is worth having a function to manually shut down the 
> connection point, as HWGUI does?

No, we should not have anything like that - it's potential GPF trap.
In Harbour Release() is called automatically when all variables
holding pointer to AX control are cleared so it's not necessary
to call it automatically.

> It seems that Release() is never called, for whatever reason.

few weeks ago I sent a small peace of code (see below) to test it and
Toninho confirmed (BTW thanks) that now AX controls are removed.
You can test it yourself and check if destructor is executed.
Please only remember that inside Release() is reference counter
which is updated also by C code so destructor is executed when
the last owner (code which executed AddRef() directly or indirectly
by some other method) calls Release().
If you will find any problems in Harbour code then please inform
us and we try to fix it but calling Release() by our code as workaround
for some other buggy code which does not call it it's very bad idea.

best regards,
Przemek



   proc test( hWnd )
      local oAx
      if valtype( hWnd ) == "N"
         hWnd := win_n2p( hWnd )
      endif
      ? "start"
      oAx := WIN_AxGetControl( hWnd, mk_cblock( mycls():new() ) )
      ? "ax control created:", oAx
      oAx := NIL
      ? "ax control destroyed"
   return

   func mk_cblock( obj )
      return {|| obj }

   class mycls
      destructor dtor
   endclass

   method procedure dtor()
      ? "*** destructor executed ***"
   return
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to