FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour OFnt:END() generating logfile
Posts: 88
Joined: Wed Apr 28, 2010 06:34 PM
OFnt:END() generating logfile
Posted: Fri Mar 10, 2017 03:48 PM

I create the font object in this way:

DEFINE FONT cFontBot NAME "Ms Sans Serif" SIZE 0, -08 BOLD

And when I finish the dialog, after the active dialog, I destroy the source object in this way:

CFontBot: END ()

But this is creating a log with this message:

10/03/2017 11:57:02: EXCESS RELEASE OF FONT Ms Sans Serif [hFont: 0] (nCount: 61)
<-TFONT: END (284) <-TWINDOW: DESTROY (2145) <- (b) TDIALOG: TDIALOG (91) <-TDIALOG: DESTROY (0) <-TWINDOW: HANDLEEVENT (0) <-TDIALOG: HANDLEEVENT (914 ) <-DIALOGBOX (0) <-TDIALOG: ACTIVATE (296) <-CHK_MESSAGE (553)

What is the solution to not creating this log?

thanks in advance

Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: OFnt:END() generating logfile
Posted: Fri Mar 10, 2017 05:00 PM

Aferra,

Don't do things like oDlg:oFont := oFontBot AND
Remove, CFontBot: END(). I believe it's not necessary anymore.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: OFnt:END() generating logfile
Posted: Fri Mar 10, 2017 05:24 PM
Remove, CFontBot: END(). I believe it's not necessary anymore.

This is necessary.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: OFnt:END() generating logfile
Posted: Fri Mar 10, 2017 05:25 PM

As Mr Vilian said, please look for code like
oObj:oFont := oFont

You should always assign a font either by using FONT clause in the command creating DIALOG/CONTROL or use oObj:SetFont( oFont )

Regards



G. N. Rao.

Hyderabad, India
Posts: 88
Joined: Wed Apr 28, 2010 06:34 PM
Re: OFnt:END() generating logfile
Posted: Fri Mar 10, 2017 05:56 PM

Okay, I'll check and return.

Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: oFnt:END() generating logfile
Posted: Tue May 23, 2017 09:17 AM
I've got the same problem with this topic
The problem is occurred on oFnt:End() that assign for DIALOG only. The :End() method of other assignment has not any problem.
Code (fw): Select all Collapse
oFnt := TFont():New( MEMVAR->aFonts[14],, -16, .F., .F., 0, 0, 400, .F., .F., .F., 222, 3, 2, 1, , 34 )
oFnt1:= TFont():New( MEMVAR->aFonts[14],, -14, .F., .F., 0, 0, 400, .F., .F., .F., 222, 3, 2, 1, , 34 )
oFnt2:= TFont():New( MEMVAR->aFonts[14],, -22, .F., .F., 0, 0, 700, .F., .F., .F., 222, 3, 2, 1, , 34 )

DEFINE DIALOG oDlg RESOURCE 'REPORT' ;
         COLOR CLR_BLACK, THEME2007 ;
         FONT oFnt
    
   oDlg:lHelpIcon := .F.

   REDEFINE TITLE oHeader ID 100 OF oDlg ; 
            SHADOW BOTTOMLEFT SHADOWSIZE 2
       
            oHeader:AddText( 8, 15, cRptTitle , , , , "BOTTOMLEFT" , oFnt2 , CLR_WHITE )
 
    REDEFINE LISTBOX oLbx ;
            FIELDS REP->REP_NR, REP->REP_NAME ;
            FIELDSIZES 50, 100 ;
            FONT oFnt ;
            HEADER 'No.', 'Report Name' ;
            ID 101 OF oDlg ;
            COLORS RGB(  0 ,   0 ,   0 ),RGB( 192 , 192 , 192 ) ;
            ON DBLCLICK if(empty(REP->REP_SECRET).or.(REP->REP_SECRET='Y'.and.UserRights(13)) , RPTPROMPT() ,  )

   oLbx:bRClicked = { | nRow, nCol, nFlags | (oLbx:SetFocus(), oLbx:lButtonDown(nRow,nCol),if(UserRights(14,.T.),ShowPopup( nRow, nCol, oDlg, oLbx ), ) ) }

    WbrStyles( oLbx )   

    oLbx:bChange    := {|| (oSays:settext( MEMVAR->FindKey ) , oSays:refresh())  }      

   oLbx:lMChange   := .F.
   oLbx:lAdjLastCol:= .T.
   oLbx:nLineStyle  := 10
   oLbx:nLineHeight := 28
   oLbx:nHeaderHeight:= 29
   oLbx:aHJustify       := { 2, 2 }
   oLbx:aJustify        := { 2, 0 }

   oLbx:bKeyChar = { | nKey | IIF(nKey = VK_RETURN , (iif((REP->REP_SECRET='Y'.and.UserRights(13)).or.REP->REP_SECRET<>'Y',RPTPROMPT(),MsgStop(' You can not print this report ')) , oLbx:SetFocus() ), ;
                                    (FindRpt(nKey,oLbx),oSays:Refresh()) ) }

   oLbx:bKeyDown = { | nKey |(IIF(nKey = VK_INSERT.and.UserRights(14,.F.), RptSet(.T.,oLbx,.F.) , ;
                                    IIF(nKey = VK_ADD   .and.UserRights(14,.F.), RptSet(.F.,oLbx,.F.) , ;
                                    IIF(nKey = VK_DELETE.and.UserRights(14,.F.), DelRpt(oLbx) , ) ) ) , oLbx:Refresh()) }


    REDEFINE SAY oSay PROMPT 'Search :' ID 202 OF oDlg  FONT oFnt1
    
    REDEFINE SAY oSays PROMPT FindKey ID 102 OF oDlg PICTURE '@!' FONT oFnt1 ;
                COLORS CLR_BLUE, CLR_WHITE
                
                oSays:lTransparent := .F.

    REDEFINE SAY oSay PROMPT 'DOUBLE CLICK OR ENTER TO SELECT OPTION' ID 201 OF oDlg ;
                FONT oFnt

ACTIVATE DIALOG oDlg CENTER RESIZE16

oFnt1:End()
oFnt2:End()
oFnt:End() <- Line 84

23/05/17 14:27:54: EXCESS RELEASE OF FONT Tahoma[ hFont : 0] ( nCount : 0 )
<-TFONT:END(285) <-REPORT(84) <-(b)MAIN(266) <-TWINDOW:ACTIVATE(1022) <-MAIN(266)
------------------------------------------------------------
23/05/17 14:39:13: EXCESS RELEASE OF FONT Tahoma[ hFont : 0] ( nCount : 0 )
<-TFONT:END(285) <-REPORT(84) <-(b)MAIN(266) <-TWINDOW:ACTIVATE(1022) <-MAIN(266)
------------------------------------------------------------
23/05/17 16:09:34: EXCESS RELEASE OF FONT Tahoma[ hFont : 0] ( nCount : 0 )
<-TFONT:END(285) <-REPORT(84) <-(b)MAIN(267) <-TWINDOW:ACTIVATE(1022) <-MAIN(267)
------------------------------------------------------------
23/05/17 16:10:24: EXCESS RELEASE OF FONT Tahoma[ hFont : 0] ( nCount : 0 )
<-TFONT:END(285) <-REPORT(84) <-(b)MAIN(267) <-TWINDOW:ACTIVATE(1022) <-MAIN(267)
------------------------------------------------------------
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: OFnt:END() generating logfile
Posted: Tue May 23, 2017 09:28 AM

You don't have to explicitly release a font assigned to a control using FONT clause. That control takes the ownership and therefore the responsibility to release it.

EMG

Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: OFnt:END() generating logfile
Posted: Tue May 23, 2017 09:34 AM
Enrico Maria Giordano wrote:You don't have to explicitly release a font assigned to a control using FONT clause. That control takes the ownership and therefore the responsibility to release it.

EMG

Dear EMG,

It means End dialog will be ended font also, doesn't it?

Thanks
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: OFnt:END() generating logfile
Posted: Tue May 23, 2017 09:41 AM

Dutch

The excess release must be happening elsewhere.
Otherwise the part of the code you published looks ok.

For testing change the size of oFnt from -16 and -17 and see

Regards



G. N. Rao.

Hyderabad, India
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: OFnt:END() generating logfile
Posted: Tue May 23, 2017 09:58 AM
As Mr Rao says, the problem may be elsewhere in your program
As stated Enrico, control has to destroy the resources that are used for control, but also if you want to be sure to destroy the fonts, you can try
Code (fw): Select all Collapse
   Do While oFont:nCount > 0
      oFont:End()
   Enddo
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: OFnt:END() generating logfile
Posted: Tue May 23, 2017 11:26 AM
It shows the same error in the same line.
23/05/17 17:53:04: EXCESS RELEASE OF FONT Tahoma[ hFont : 0] ( nCount : 0 )
<-TFONT:END(285) <-REPORT(86) <-(b)MAIN(267) <-TWINDOW:ACTIVATE(1022) <-MAIN(267)
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: OFnt:END() generating logfile
Posted: Tue May 23, 2017 01:13 PM
cnavarro wrote:As Mr Rao says, the problem may be elsewhere in your program
As stated Enrico, control has to destroy the resources that are used for control, but also if you want to be sure to destroy the fonts, you can try
Code (fw): Select all Collapse
   Do While oFont:nCount > 0
      oFont:End()
   Enddo

Mr Cristobal
This is not a case of under release of fonts.
This is a case where a font is released more than it is incremented.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion