Author Topic: Some leaks in Pixelmap  (Read 165 times)

HSE

  • Member
  • ****
  • Posts: 769
  • <AMD>< 7-32>
Some leaks in Pixelmap
« 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:
Code: [Select]
    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:
Code: [Select]
invoke DeleteObject, hTempDIBSect             ;Delete hTempDIBSect

MethodEnd


Regards.


Biterider

  • Moderator
  • Member
  • *****
  • Posts: 212
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Re: Some leaks in Pixelmap
« Reply #1 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

HSE

  • Member
  • ****
  • Posts: 769
  • <AMD>< 7-32>
Re: Some leaks in Pixelmap
« Reply #2 on: August 06, 2018, 05:12:25 AM »
Enjoy holidays  :t

 

caballero

  • Member
  • *****
  • Posts: 1045
Re: Some leaks in Pixelmap
« Reply #3 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
En un lugar de la Mancha de cuyo nombre no quiero acordarme

- There are 10 kind of people: those who know binary numbers and those who don't -

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 212
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Re: Some leaks in Pixelmap
« Reply #4 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
« Last Edit: August 09, 2018, 07:21:32 AM by Biterider »

HSE

  • Member
  • ****
  • Posts: 769
  • <AMD>< 7-32>
Re: Some leaks in Pixelmap
« Reply #5 on: August 09, 2018, 02:10:14 AM »
Very close  :biggrin:

But you can't delete bits yet:
Code: [Select]
    ;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:
Code: [Select]
    invoke DeleteObject, hTempDIBSect             ;Delete hTempDIBSect

MethodEnd

An option is to move all that block to the end.

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 212
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Re: Some leaks in Pixelmap
« Reply #6 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

HSE

  • Member
  • ****
  • Posts: 769
  • <AMD>< 7-32>
Re: Some leaks in Pixelmap
« Reply #7 on: August 09, 2018, 08:05:39 AM »
 :t