Page 1 of 1
BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Fri Dec 20, 2019 5:37 pm
by MOISES
Hi,
Those fonts are not released:
-- FONT,-1710615546,TWINDOW:GETFONT(2995)->TWINDOW:NEW(960)->MAIN(657)
-- BRUSH,152049635,TRPANEL:REGISTER(779)->TRPANEL:NEW(50)->TRIBBONBAR:NEW(314)->MAIN(664)
-- FONT,-1811279512,TRICHEDIT:REDEFINE(403)->ALTASCLIENTE(1527)->->TXBROWSE:LDBLCLICK(5071)->TWINDOW:HANDLEEVENT(0)->TCONTROL:HANDLEEVENT(1801)->TXBROWSE:HANDLEEVENT(11221)->_FWH(3559)->DIALOGBOXINDIRECT(0)->TDIALOG:ACTIVATE(304)->VERCLIENTES(2036)->(b)MAIN(685)->TRBTN:CLICK(717)->TRBTN:LBUTTONUP(917)->TCONTROL:HANDLEEVENT(1791)->TRBTN:HANDLEEVENT(1575)->_FWH(3559)->WINRUN(0)->TWINDOW:ACTIVATE(1097)->MAIN(761)
====================================================================================================
Thank you.
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sat Dec 21, 2019 5:33 pm
by Silvio.Falconi
At the end of your app
Release ofontname
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 9:48 am
by MOISES
Silvio,
I haven't defined any font, these are Fivewin's internal fonts.
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 10:05 am
by cnavarro
MOISES wrote:Silvio,
I haven't defined any font, these are Fivewin's internal fonts.
I do not get any message of resources not destroyed in any of my applications (for example FivEdit uses more than 20 fonts in the different controls).
It is usually an incorrect assignment of the font, for example (:: oFont: = oFont1, instead of using its method :: SetFont (oFont1))
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 11:00 am
by MOISES
Cristóbal,
Can you please try to use a Ribbon and a RICHEDIT control?
I don´t define fonts, so it is an internal issue of Fivewin.
Thank you.
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 11:24 am
by cnavarro
It is possible that there is some control in which this problem occurs. Can you give a simple example to check?
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 6:43 pm
by MOISES
Sure.
This is a RTF sample:
Code: Select all
#Include "FiveWin.ch"
#include "richedit.ch"
//----------------------------------------------------------------------------//
Function Main()
Local oDlg, oRich, cRtf := ""
Local hRichDLL := LoadLibrary( "riched20.dll" )
local lBold := .F., nPos := 0
// Debug Checkres
FErase("checkres.txt")
SetResDebug( .T. )
cRtf:="{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Courier New;}}"+CRLF+;
"{\colortbl ;\red0\green77\blue187;\red192\green80\blue77;}"+CRLF+;
"{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\cf1\lang1031\f0\fs22 This is \b colored \b0 text\cf0 . \cf2 The background is color 1 and the foreground is color 2\cf0\par"+CRLF+CRLF+;
"}"
DEFINE DIALOG oDlg NAME "Test"
REDEFINE RICHEDIT oRich VAR cRTF OF oDlg ID 100
//oRich:lHighLight = .f.
REDEFINE BUTTON ID 110 ACTION ( oRich:LoadFromRTFFile( cGetFile( "Archivo RTF (*.rtf) | *.rtf" ), oRich:SetFocus() ) )
REDEFINE BUTTON ID 120 ACTION ( lBold := ! lBold, ;
oRich:SetBold( lBold ), oDlg:Update(), oRich:SetFocus(), oDlg:cTitle := "IsBold "+cValtoChar(lBold) )
oRich:SetText( cRtf )
//oRich:bGotFocus = { || oRich:HideSel(), oRich:SetSel( nPos, nPos ) }
//oRich:bLostFocus = { || nPos := oRich:GetPos() }
ACTIVATE DIALOG oDlg CENTERED
FreeLibrary( hRichDLL )
/* CheckRes Recursos FWH*/
CheckRes()
WinExec("notepad checkres")
Return nil
Bug at: TRICHEDIT:REDEFINE(403)-
You have an unreleased Font, defined in both new and redefine methods.
Thank you.
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 7:21 pm
by cnavarro
Please send me .rc file, thanks
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Mon Dec 23, 2019 8:32 am
by MOISES
Sure, here is:
Code: Select all
#include <windows.h>
#define IDC_EDIT1 101
Test DIALOG 41, 64, 409, 199
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Testing the RichEdit control"
FONT 8, "MS Sans Serif"
{
CONTROL "", 100, "RichEdit20A", 4100 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 6, 12, 398, 163
PUSHBUTTON "&Load text file", 110, 5, 179, 50, 16
PUSHBUTTON "&Bold", 120, 95, 179, 50, 16
}
Thank you.
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Mon Dec 23, 2019 10:31 am
by cnavarro
Moises, thanks, you are right
Please modify METHOD Redefine in TRichEdit CLASS
Code: Select all
//----------------------------------------------------------------------------//
METHOD ReDefine( nId, bSetGet, oWnd, nHelpId, oFont, cMsg, lReadOnly, ;
lHighlight, cFileName, nRTFSize, lNoURL, bWhen, bValid, ;
bChanged ) CLASS TRichEdit
DEFAULT lReadOnly := .f., ;
lHighlight := .f., ;
cFileName := "" , ;
nRTFSize := 1024 * 1024, ;
lNoURL := .f., ;
oWnd := GetWndDefault()
::nId = nId
::bSetGet = bSetGet
::uOriginalValue = Eval( ::bSetGet )
::oWnd = oWnd
::nHelpId = nHelpId
::cMsg = cMsg
::bWhen = bWhen
::bValid = bValid
::lReadOnly = lReadOnly
::bChange = bChanged
::cFileName = cFileName
::nRTFSize = Max( nRTFSize, 32 * 1024 )
::lURL = !lNoURL
::lHighlight = lHighlight
::aKeywords1 = { "CLASS", "FROM", "ENDCLASS", "DATA", "AS", "METHOD",;
"CONSTRUCTOR", "function", "return", "OBJECT", "ENDOBJECT" }
::aKeywords2 = { "#include", "Self", "nil", "public", "local", "Super" }
::cSeparators = " +-()[]:*/{},="
::nClrNumber = CLR_HMAGENTA
::nClrString = CLR_YELLOW
::nClrComment = CLR_HBLUE
::nClrSeparator = CLR_WHITE
::nClrText = CLR_BLACK
::nClrKey1 = CLR_HGREEN
::nClrKey2 = CLR_HCYAN
if oFont == nil
DEFINE FONT ::oFont NAME "ARIAL" SIZE 0,If( LargeFonts(), -11, -13 )
else
::SetFont( oFont )
endif
::SetOleInit()
//::Register( nOr( CS_VREDRAW, CS_HREDRAW, CS_DBLCLKS ) )
oWnd:DefControl( Self )
return Self
//----------------------------------------------------------------------------//
and in CLASS TRICHEDIT5 ( fwh\source\classes\triched5.prg )
Code: Select all
METHOD ReDefine( nId, bSetGet, oWnd, nHelpId, oFont, cMsg, lReadOnly, ;
lHighlight, cFileName, nRTFSize, lNoURL, bWhen, bValid, ;
bChanged, nLeftMargin, lNew ) CLASS TRichEdit5
local cDll
DEFAULT lReadOnly := .f., ;
lHighlight := .f., ;
cFileName := "" , ;
nRTFSize := 1024 * 1024, ;
lNoURL := .f., ;
oWnd := GetWndDefault(), ;
nLeftMargin := 0//, ;
lNew := .T.
::lUnicode := FW_SetUnicode()
::nId := nId
::bSetGet := bSetGet
::uOriginalValue = Eval( ::bSetGet )
::oWnd := oWnd
::nHelpId := nHelpId
::cMsg := cMsg
::bWhen := bWhen
::bValid := bValid
::lReadOnly := lReadOnly
::bChange := bChanged
::cFileName := cFileName
::nRTFSize := Max( nRTFSize, 32 * 1024 )
::lURL := !lNoURL
::lCaptured := .f.
if lNew
::cCtrl_Class := "RichEdit50W"
cDll := "Msftedit.dll"
else
::cCtrl_Class := "RichEdit20A"
cDll := "RichEd20.dll"
endif
if ::nInst == 0
::hLib := LoadLibrary( cDll )
endif
::nInst ++
if bSetGet != nil
::cCaption := cValToChar( Eval( bSetGet ) )
else
::cCaption := ""
endif
::lHighlight := lHighlight
::aKeyWords1 := {}
::aKeyWords1 := {}
::cSeparators := ""
::aCharFormat := {} // Array( 14 )
::nClrNumber := CLR_HMAGENTA
::nClrString := CLR_YELLOW
::nClrComment := CLR_HBLUE
::nClrSeparator := CLR_WHITE
::nClrText := CLR_BLACK
::nClrKey1 := CLR_HGREEN
::nClrKey2 := CLR_HCYAN
::nClrProtect := CLR_HRED
::nMarginLeft := nLeftMargin
if oFont == nil
DEFINE FONT ::oFont NAME "ARIAL" SIZE 0,If( LargeFonts(), -11, -13 )
else
::SetFont( oFont )
endif
::aTableFormat := Array( 7 )
::aPos := { 0, 0 }
::aOldPos := { 0, 0 }
::SetOleInit()
::Default()
::SendMsg( WM_SETFONT, ::oFont:hFont, 0 )
oWnd:DefControl( Self )
::SetFont2RTF( ::oFont:nHeight ) // to adjust point size
if ::lHighlight
::HighLightAllText() // PostMessage( ::hWnd, FM_HIGHLIGHTALL )
endif
if !Empty( ::nMarginLeft )
::SetMargin()
endif
return Self
//----------------------------------------------------------------------------//
I recommend that you use the new TRICHEDIT5 class