View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003876 | JEDI VCL | 00 JVCL Components | public | 2006-08-29 07:31 | 2006-08-29 11:05 |
Reporter | michel_b | Assigned To | AHUser | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.10 | ||||
Target Version | Fixed in Version | ||||
Summary | 0003876: Resource leak in TJvMainMenu and TJvPopupMenu | ||||
Description | Using a TJvMainMenu or TJvPopupMenu introduces a resource leak with a device context not properly released. This leak was not detected by MemProof. The problematic code is in, TJvMainMenu.WMMeasureItem and TJvPopupMenu.WMMeasureItem. The error is because the parameters to ReleaseDC are inverted. The windows API documentation indicates, int ReleaseDC( HWND hWnd, // handle to window HDC hDC // handle to DC ); but the calls are made, ReleaseDC(DC, 0); The proper call is, ReleaseDC( 0, DC ) as 0 is the window handle (the desktop). The line must be corrected in both TJvMainMenu.WMMeasureItem and TJvPopupMenu.WMMeasureItem. | ||||
Additional Information | If many owner drawn menus are displayed and use a windows error similar to the following will be raised: Description: EInvalidOperation: Canvas does not allow drawing --> In module Graphics and method Graphics.TCanvas.RequiredState (file and line unknown) --> In module Graphics and method Graphics.TCanvas.RequiredState (file and line unknown) --> In module Menus and method Menus.TMenuItem.MeasureItem (file and line unknown) --> In module Forms and method Forms.TCustomForm.WndProc (file and line unknown) --> In module JvWndProcHook and method JvWndProcHook.TJvHookInfos.WindowProc (JvWndProcHook.pas, line\ 767) --> In module Controls and method Controls.TWinControl.MainWndProc (file and line unknown) --> In module Classes and method Classes.StdWndProc (file and line unknown) --> In module Controls and method Controls.TWinControl.DefaultHandler (file and line unknown) --> In module Controls and method Controls.TWinControl.WndProc (file and line unknown) --> In module Forms and method Forms.TCustomForm.WndProc (file and line unknown) --> In module JvWndProcHook and method JvWndProcHook.TJvHookInfos.WindowProc (JvWndProcHook.pas, line\ 767) --> In module Controls and method Controls.TWinControl.MainWndProc (file and line unknown) --> In module Classes and method Classes.StdWndProc (file and line unknown) --> In module Forms and method Forms.TCustomForm.SetMenu (file and line unknown) --> In module Forms and method Forms.TCustomForm.CMMenuChanged (file and line unknown) --> In module Controls and method Controls.TWinControl.WndProc (file and line unknown) --> In module Forms and method Forms.TCustomForm.WndProc (file and line unknown) --> In module JvWndProcHook and method JvWndProcHook.TJvHookInfos.WindowProc (JvWndProcHook.pas, line\ 767) --> In module Controls and method Controls.TWinControl.MainWndProc (file and line unknown) --> In module Classes and method Classes.StdWndProc (file and line unknown) --> In module Menus and method Menus.TMainMenu.MenuChanged (file and line unknown) --> In module JvMenus and method JvMenus.TJvMainMenu.MenuChanged (JvMenus.pas, line 925) | ||||
Tags | No tags attached. | ||||