OFnt:END() generating logfile
OFnt:END() generating logfile
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
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
Re: OFnt:END() generating logfile
Aferra,
Don't do things like oDlg:oFont := oFontBot AND
Remove, CFontBot: END(). I believe it's not necessary anymore.
Don't do things like oDlg:oFont := oFontBot AND
Remove, CFontBot: END(). I believe it's not necessary anymore.
- nageswaragunupudi
- Posts: 10720
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: OFnt:END() generating logfile
Remove, CFontBot: END(). I believe it's not necessary anymore.
This is necessary.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10720
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: OFnt:END() generating logfile
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 )
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
G. N. Rao.
Hyderabad, India
Re: oFnt:END() generating logfile
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.
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
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)
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)
- Enrico Maria Giordano
- Posts: 8738
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: OFnt:END() generating logfile
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
EMG
Re: OFnt:END() generating logfile
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)
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)
- nageswaragunupudi
- Posts: 10720
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: OFnt:END() generating logfile
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
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
G. N. Rao.
Hyderabad, India
Re: OFnt:END() generating logfile
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
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
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
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
Re: OFnt:END() generating logfile
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)
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)
- nageswaragunupudi
- Posts: 10720
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: OFnt:END() generating logfile
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 tryCode: Select all | Expand
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
G. N. Rao.
Hyderabad, India