Hi Pritpal,

I see this code in hbxbp:
---
METHOD HbpQtUI:destroy()
   LOCAL a_

   FOR EACH a_ IN ::aSignals
      Qt_Slots_disConnect( ::pSlots, a_[ 1 ], a_[ 2 ] )
   NEXT

   FOR EACH a_ IN ::aEvents
      Qt_Events_disConnect( ::pEvents, a_[ 1 ], a_[ 2 ] )
   NEXT

   ...

   RETURN NIL

METHOD HbpQtUI:event( cWidget, nEvent, bBlock )

   IF hb_hHasKey( ::qObj, cWidget )
      IF Qt_Events_Connect( ::pEvents, ::qObj[ cWidget ], nEvent, bBlock )
         aadd( ::aEvents, { ::qObj[ cWidget ], nEvent } )
      ENDIF
   ENDIF

   RETURN Self
---

Which is redundant, because we're keeping track 
of events/slots in both ::pSlots/::pEvents, and 
also maintaining a .prg level copy of the list in 
::aSlots/::aEvents. It's also prone to leak/GPF, as 
it's up to .prg level code to make sure all slots/events 
are disconnected.

By using GC facility, would it be possible to rework 
hbqt low-levels, to allow for this code, solving both 
problems:
---
METHOD HbpQtUI:destroy()
   LOCAL a_

   ::pSlots := NIL
   ::pEvents := NIL

   ...

   RETURN NIL

METHOD HbpQtUI:event( cWidget, nEvent, bBlock )

   IF cWidget $ ::qObj
      Qt_Events_Connect( ::pEvents, ::qObj[ cWidget ], nEvent, bBlock )
   ENDIF

   RETURN Self
---

What do you think?

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to