OFnt:END() generating logfile

Post Reply
aferra
Posts: 88
Joined: Wed Apr 28, 2010 6:34 pm

OFnt:END() generating logfile

Post by aferra »

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
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: OFnt:END() generating logfile

Post by vilian »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: OFnt:END() generating logfile

Post by nageswaragunupudi »

Remove, CFontBot: END(). I believe it's not necessary anymore.
This is necessary.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: OFnt:END() generating logfile

Post by nageswaragunupudi »

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
aferra
Posts: 88
Joined: Wed Apr 28, 2010 6:34 pm

Re: OFnt:END() generating logfile

Post by aferra »

Okay, I'll check and return.
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: oFnt:END() generating logfile

Post by dutch »

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: Select all

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 19.01 / 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)
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: OFnt:END() generating logfile

Post by Enrico Maria Giordano »

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
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: OFnt:END() generating logfile

Post by dutch »

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 19.01 / 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)
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: OFnt:END() generating logfile

Post by nageswaragunupudi »

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
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: OFnt:END() generating logfile

Post by cnavarro »

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: Select all

   Do While oFont:nCount > 0
      oFont:End()
   Enddo
 
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: OFnt:END() generating logfile

Post by dutch »

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 19.01 / 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)
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: OFnt:END() generating logfile

Post by nageswaragunupudi »

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: Select all

   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
Post Reply