The MASM Forum

Projects => ObjAsm => Topic started by: HSE on August 05, 2018, 10:25:12 AM

Title: Some leaks in Pixelmap
Post by: HSE on August 05, 2018, 10:25:12 AM
Hi Biterider!

Fantastic Pixelmap  :t

In DrawStr there is a not working pushing nightmare. That must be:    invoke DrawTextEx, hTempDC, pText, -1, addr TextRect, dRenderFlags, NULL
    ;Release resources
    push hTempDC
    call SelectObject                             ;Unselect hTempDIBSect
   
    push hTempDC
    call SelectObject                             ;Unselect hFont

    push hTempDC
    call DeleteDC                                 ;Delete hTempDC

and in same method: invoke DeleteObject, hTempDIBSect             ;Delete hTempDIBSect

MethodEnd



Regards.

Title: Re: Some leaks in Pixelmap
Post by: Biterider on August 05, 2018, 06:40:13 PM
Hi HSE
I'll look into it as soon as I'm back from holidays (Spain)  :icon_cool:
Biterider
Title: Re: Some leaks in Pixelmap
Post by: HSE on August 06, 2018, 05:12:25 AM
Enjoy holidays  :t

Title: Re: Some leaks in Pixelmap
Post by: avcaballero on August 06, 2018, 06:22:27 PM
I imagine that your like is the beach, although there are also many other lovely places to see. Though I suppose you are already better informed even than I could advise you. Enjoy it. :t
Title: Re: Some leaks in Pixelmap
Post by: Biterider on August 09, 2018, 01:13:34 AM
Thanks HSE  :icon14:
You are completely right. There is a bug while pushing the arguments when cleaning up the DrawStr method.

Attached the corrected OA32 Pixelmap version.

Biterider
Title: Re: Some leaks in Pixelmap
Post by: HSE on August 09, 2018, 02:10:14 AM
Very close  :biggrin:

But you can't delete bits yet:
    ;Release resources
    push hTempDC
    call SelectObject                             ;Unselect hTempDIBSect & select prev DIBSect
    >>>>  invoke DeleteObject, eax                      ;Delete unselected hTempDIBSect
    push hTempDC
    call SelectObject                             ;Unselect hFont & select prev Font
    invoke DeleteDC, hTempDC                      ;Delete hTempDC



Just at the end:    invoke DeleteObject, hTempDIBSect             ;Delete hTempDIBSect

MethodEnd


An option is to move all that block to the end.
Title: Re: Some leaks in Pixelmap
Post by: Biterider on August 09, 2018, 07:19:58 AM
Ops, you are right (again)  :P
I moved the offending line to the end, were it should be!

As redress, I added the unicode version  ;)

Previous post updated.


Biterider
Title: Re: Some leaks in Pixelmap
Post by: HSE on August 09, 2018, 08:05:39 AM
 :t