Bug 30058 - unwrap Glyphs, Composite and AddTraps at damageCloseScreen
Summary: unwrap Glyphs, Composite and AddTraps at damageCloseScreen
Status: RESOLVED MOVED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: 7.5 (2009.10)
Hardware: All Linux (All)
: medium major
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-07 00:15 UTC by SooChan Lim
Modified: 2018-12-13 22:24 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description SooChan Lim 2010-09-07 00:15:43 UTC
I had found that Xserver did not execute the exaGlyphsFini() while the Xserver calls closeScreen functions. The issue is that the server cannot free the exaglyph cache picture due to not calling exaGlyphsFini(),and then it cause the memory leak when the Xserver is termitated.

 I have analyzed the closeScreen routines and I found the reason why the exaGlyphsFini() is not called. It is because the ps->Glyphs is not equal to exaGlyphs at exaCloseScreen. 
=========================================================================
static Bool
exaCloseScreen(int i, ScreenPtr pScreen)
{
    ExaScreenPriv(pScreen);
#ifdef RENDER
    PictureScreenPtr	ps = GetPictureScreenIfSet(pScreen);
#endif

    if (ps->Glyphs == exaGlyphs) /* This is not TRUE */
	exaGlyphsFini(pScreen);

---- omitted ---


    xfree (pExaScr);

    return (*pScreen->CloseScreen) (i, pScreen);
}
=========================================================================

 In a depth analysis, I realized that the root cause of this leak is that unwrapping the private functions, which are Glyphs, Composite, and AddTraps, does not exist at damageCloseScreen().

 The private functions of Glyphs, Composite, AddTraps are created at the time of DamageSetup(). However, there is no calling of unwrapping at the time of damageCloseScreen(). Therefore, I suggest that damageCloseScreen() func contains
 unwrap function for the Glyphs, Compsoite, and AddTraps for preventing the memory leak.

The code to be fixed is below. Please check the code. 

===============================================================================
static Bool
damageCloseScreen (int i, ScreenPtr pScreen)
{
    damageScrPriv(pScreen);

    PictureScreenPtr	ps = GetPictureScreenIfSet(pScreen);

    unwrap (pScrPriv, pScreen, DestroyPixmap);
    unwrap (pScrPriv, pScreen, CreateGC);
    unwrap (pScrPriv, pScreen, CopyWindow);
    unwrap (pScrPriv, pScreen, CloseScreen);

    if (ps) {
	unwrap (pScrPriv, ps, Glyphs);
	unwrap (pScrPriv, ps, Composite);
	unwrap (pScrPriv, ps, AddTraps);
    }
    
    xfree (pScrPriv);
    return (*pScreen->CloseScreen) (i, pScreen);
}
===============================================================================  

Thank you.
SooChan Lim.
Comment 1 GitLab Migration User 2018-12-13 22:24:39 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/406.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.