Wednesday, May 13, 2009

Found the GDI leak source

After several checks saw that the TreeView is not leaking (as the nUnit tests were showing).
After verifying each of the components involved in drawing (the Weifen Luo window on which a Custom control is put, control that contains a table layout panel and four controls on which OpenCascade renders) found who causes the GDI leaking: in Naro there are 4 views from which only one is visible and the other 3 are hidden. For each control an OCC view is created and mapped to it. Somehow this creates problems at the OCC level, GDI leaks appear even if all the four windows are displayed. Made and uploaded a temporary solution to create only one OCC view mapped on the visible view and this doesn't leak, this should solve many of the Naro crashes. In order to enable for the user to display four views more research is needed to understand how mapping is made especially when many windows are mapped in the same time and also what are the handles that cause the leaking and how should they be correctly used. This also explains why the nUnit OCC tests passed with no leaks, they were using only one window.

No comments: