Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Hi DPI support function doesn't release DC #10707

Closed
JeffryBooher opened this issue Mar 6, 2015 · 3 comments
Closed

Hi DPI support function doesn't release DC #10707

JeffryBooher opened this issue Mar 6, 2015 · 3 comments

Comments

@JeffryBooher
Copy link
Contributor

The function below doesn't release the drawing context it uses to get the Device Capabilities which could lead to instability -- Windows will allocate memory for new ones (unless you change the CEF Window class to use a shared DC).

Even though this is only called once per Window, each new Debugger Window, Popup window (PSDLens Cloud Login), or using Debug > New Brackets Window will create a new window and eventually Brackets will run out of handles.

UINT cef_window::GetDPIScalingX() const
{
    HDC dc = GetDC();
    float lpx = dc ? GetDeviceCaps(dc,LOGPIXELSX):DEFAULT_WINDOWS_DPI ;
    //scale factor as it would look in a default(96dpi) screen. the default will be always 96 logical DPI when scaling is applied in windows.
    //see. https://msdn.microsoft.com/en-us/library/ms701681(v=vs.85).aspx 
    return (lpx/DEFAULT_WINDOWS_DPI)*100; 
}
@peterflynn
Copy link
Member

@JeffryBooher Good catch!

@abose Can you look into this for 1.3? (Looks like this code is yours)

Lowering priority to Medium though, since opening new windows is a fairly uncommon workflow in Brackets currently, making the impact of this likely to be rare in practice.

abose added a commit to adobe/brackets-shell that referenced this issue Mar 10, 2015
adobe/brackets/issues/10707:
The function doesn't release the drawing context it uses to get the
Device Capabilities which could lead to instability -- Windows will
allocate memory for new ones (unless you change the CEF Window class to
use a shared DC).

Even though this is only called once per Window, each new Debugger
Window, Popup window (PSDLens Cloud Login), or using Debug > New
Brackets Window will create a new window and eventually Brackets will
run out of handles.
@abose
Copy link
Contributor

abose commented Mar 10, 2015

Pull request submitted.
adobe/brackets-shell#508

@prafulVaishnav
Copy link
Contributor

PR has been merged to shell.

abose added a commit to adobe/brackets-shell that referenced this issue Dec 8, 2015
adobe/brackets/issues/10707:
The function doesn't release the drawing context it uses to get the
Device Capabilities which could lead to instability -- Windows will
allocate memory for new ones (unless you change the CEF Window class to
use a shared DC).

Even though this is only called once per Window, each new Debugger
Window, Popup window (PSDLens Cloud Login), or using Debug > New
Brackets Window will create a new window and eventually Brackets will
run out of handles.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants