OFnt:END() generating logfile

OFnt:END() generating logfile

Postby aferra » Fri Mar 10, 2017 3: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
aferra
 
Posts: 88
Joined: Wed Apr 28, 2010 6:34 pm

Re: OFnt:END() generating logfile

Postby vilian » Fri Mar 10, 2017 5: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
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: OFnt:END() generating logfile

Postby nageswaragunupudi » Fri Mar 10, 2017 5:24 pm

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

This is necessary.
Regards

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

Re: OFnt:END() generating logfile

Postby nageswaragunupudi » Fri Mar 10, 2017 5: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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: OFnt:END() generating logfile

Postby aferra » Fri Mar 10, 2017 5:56 pm

Okay, I'll check and return.
aferra
 
Posts: 88
Joined: Wed Apr 28, 2010 6:34 pm

Re: oFnt:END() generating logfile

Postby dutch » Tue May 23, 2017 9: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: Select all  Expand view
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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: OFnt:END() generating logfile

Postby Enrico Maria Giordano » Tue May 23, 2017 9: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
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: OFnt:END() generating logfile

Postby dutch » Tue May 23, 2017 9: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 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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: OFnt:END() generating logfile

Postby nageswaragunupudi » Tue May 23, 2017 9: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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: OFnt:END() generating logfile

Postby cnavarro » Tue May 23, 2017 9: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: Select all  Expand view

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

Re: OFnt:END() generating logfile

Postby dutch » 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 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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: OFnt:END() generating logfile

Postby nageswaragunupudi » Tue May 23, 2017 1: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: Select all  Expand view

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 105 guests