PR# 18592 WEL_BITMAP_HELPER resource wasting

Problem Report Summary
Submitter: technoben59
Category: WEL
Priority: Medium
Date: 2013/05/05
Class: Bug
Severity: Serious
Number: 18592
Release: 7.2
Confidential: No
Status: Open
Responsible: manus_eiffel
Environment: Windows XP SP3
Synopsis: WEL_BITMAP_HELPER resource wasting

Using thw class WEL_BITMAP_HELPER, I saw a consumption of GDI and memory resources. Investigating the problem, i noted:
1) the routine 'info_of_bitmap' creates a memory DC without succesive
deletion - GDI resource wasting
2) the routine 'mirror_image' allocates memory (l_bits) without
successive deallocation - memory wasting

To workaround the problem, I redefined the two routines; the resource wasting was resolved but the workaraond on 'mirror_image' (a free of memory using l_bits.item.memory_free) caused a segmentation violation at program exit. This occurred only after specifc conditions.

Reinvestigating the problem through a debugger, I saw (I thought) that the violation occurs because the garbage collector would free a MANAGED_POINTER already free. I supposed was my workaround that caused it. So I redefined also WEL_MEMORY_DC.di_bits_pointer to have as return a POINTER (and not a MANAGED_POINTER). Now it runs OK
To Reproduce
I have submitted an application that try to reproduce the problems. Contains 3 routines to test.
The first illustrate the resource wasting using current library
The second illustrate the segmentation violation occurring after redefinition of WEL_BITMAP_HELPER with manual memeory freeing.
The third illustrate a working running.

To run the sample is necessary change the definition of the image file to work on and selection of test to run.

The routine for reproduce the segmentation violation was not easy to do because it occurs only after determinate conditions illustrated in the code. While trying to code the sample, I saw a violation raised before the procedure finished.

Saluti - Paolo Benassi
Problem Report Interactions
From:technoben59    Date:2013/05/05    Download   
Attachments for problem report #18592

Attachment: bug report.rar     Size:6670