flat assembler
Message board for the users of flat assembler.
Index
> IDE Development > FASMW (small) memory leak ? |
Author |
|
revolution 14 Jun 2011, 16:13
The current font is deleted the next time you change to a new font. Only one font is active at any one time.
|
|||
14 Jun 2011, 16:13 |
|
ouadji 14 Jun 2011, 17:02
Quote:
Quote: Only one font is active at any one time. When you are leaving the dialog box, there are two fonts active The first one Code: .change_font: mov esi,tmp_font mov edi,backup_font mov ecx,sizeof.LOGFONT shr 2 rep movsd invoke ChooseFont,cf or eax,eax jz .change_font_cancelled invoke SendDlgItemMessage,\ [hwnd_dlg],ID_PREVIEW,WM_GETFONT,0,0 mov ebx,eax invoke CreateFontIndirect,[cf.lpLogFont] <------------- and the second one Code: .ok: mov esi,tmp_colors mov edi,editor_colors mov ecx,colors_number rep movsd mov esi,tmp_font mov edi,font mov ecx,sizeof.LOGFONT shr 2 rep movsd invoke CreateFontIndirect,font ;<-------------- |
|||
14 Jun 2011, 17:02 |
|
revolution 14 Jun 2011, 17:06
Do you see the "DeleteObject" call? What is it deleting?
|
|||
14 Jun 2011, 17:06 |
|
ouadji 14 Jun 2011, 17:35
Code: ;1) .change_font: ..... invoke CreateFontIndirect,[cf.lpLogFont] ;-----> object n°1 ; where is the "mov [hfont],eax" ? ;---------------------------------------- ;2) .ok: ..... invoke CreateFontIndirect,font ;-----> object n°2 ;xchg eax,[hfont] ;invoke DeleteObject,eax The "DeleteObject" does not delete the object n°1 ! This "DeleteObject" deletes the object whose handle is contained in "[hfond]". but the result_handle from CreateFontIndirect n°1 is not put in [hfond] ... this handle (from CreateFontIndirect n°1) is not saved, this handle is lost ! Last edited by ouadji on 14 Jun 2011, 17:47; edited 1 time in total |
|||
14 Jun 2011, 17:35 |
|
ouadji 14 Jun 2011, 17:43
[tempo] != eax this "DeleteObject" does not delete object n°1 Code: ;1) tempo dd ? .change_font: ..... invoke CreateFontIndirect,[cf.lpLogFont] ;--> object n°1 mov [tempo],eax ;---------------------------------------- ;2) .ok: ..... invoke CreateFontIndirect,font ;--> object n°2 xchg eax,[hfont] ;<----- [tempo] != eax (syser debugger) invoke DeleteObject,eax |
|||
14 Jun 2011, 17:43 |
|
revolution 14 Jun 2011, 17:48
You are right, a second font is active but not used.
However there is still no memory leak since that second inactive font (stored in hfont) is deleted next time the dialog is active. |
|||
14 Jun 2011, 17:48 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.