[PATCH] input: free the EQ allocated memory on shutdown (#38634)

Peter Hutterer peter.hutterer at who-t.net
Sun Jun 26 23:02:19 PDT 2011


On Sun, Jun 26, 2011 at 06:13:42PM -0700, Jeremy Huddleston wrote:
> You should add that to XQuartz's CloseInput in darwinXinput.c rather than adding a duplicate symbol in darwin.c
> 
> Assuming you do that,
> Acked-by: Jeremy Huddleston <jeremyhu at apple.com>

Obviously xquartz is your area but if you abstract the EQ creation wouldn't
it be better for symmetry to have EQ destruction handled in the same manner?
otherwise you have CloseInput finalizing something that wasn't even
initialized in the same file.

Cheers,
  Peter

> 
> On Jun 26, 2011, at 17:39, Peter Hutterer wrote:
> 
> > mieqFini() already does the right thing, but it needs to be called by the
> > various DDXs and the XTest Extension.
> > 
> > X.Org Bug 38634 <http://bugs.freedesktop.org/show_bug.cgi?id=38634>
> > 
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> > Xext/xtest.c                 |    9 ++++++++-
> > hw/dmx/dmxinput.c            |    1 +
> > hw/kdrive/ephyr/ephyrinit.c  |    1 +
> > hw/kdrive/fake/fakeinit.c    |    1 +
> > hw/kdrive/fbdev/fbinit.c     |    1 +
> > hw/kdrive/src/kdrive.h       |    2 ++
> > hw/kdrive/src/kinput.c       |    6 ++++++
> > hw/vfb/InitInput.c           |    1 +
> > hw/xfree86/common/xf86Init.c |    1 +
> > hw/xnest/Init.c              |    1 +
> > hw/xquartz/darwin.c          |    4 ++++
> > hw/xquartz/darwinEvents.c    |    4 ++++
> > hw/xquartz/darwinEvents.h    |    1 +
> > hw/xwin/InitInput.c          |    1 +
> > 14 files changed, 33 insertions(+), 1 deletions(-)
> > 
> > diff --git a/Xext/xtest.c b/Xext/xtest.c
> > index daa6430..cc675c1 100644
> > --- a/Xext/xtest.c
> > +++ b/Xext/xtest.c
> > @@ -679,12 +679,19 @@ GetXTestDevice(DeviceIntPtr master)
> >     return NULL;
> > }
> > 
> > +static void
> > +XTestExtensionTearDown(ExtensionEntry *e)
> > +{
> > +    FreeEventList(xtest_evlist, GetMaximumEventsNum());
> > +    xtest_evlist = NULL;
> > +}
> > +
> > void
> > XTestExtensionInit(INITARGS)
> > {
> >     AddExtension(XTestExtensionName, 0, 0,
> >             ProcXTestDispatch, SProcXTestDispatch,
> > -            NULL, StandardMinorOpcode);
> > +            XTestExtensionTearDown, StandardMinorOpcode);
> > 
> >     xtest_evlist = InitEventList(GetMaximumEventsNum());
> > }
> > diff --git a/hw/dmx/dmxinput.c b/hw/dmx/dmxinput.c
> > index 568bb88..f006af4 100644
> > --- a/hw/dmx/dmxinput.c
> > +++ b/hw/dmx/dmxinput.c
> > @@ -77,6 +77,7 @@ void InitInput(int argc, char **argv)
> > 
> > void CloseInput(void)
> > {
> > +    mieqFini();
> > }
> > 
> > /** Called from dix/dispatch.c in Dispatch() whenever input events
> > diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
> > index 2deb7b8..e9f3525 100644
> > --- a/hw/kdrive/ephyr/ephyrinit.c
> > +++ b/hw/kdrive/ephyr/ephyrinit.c
> > @@ -97,6 +97,7 @@ InitInput (int argc, char **argv)
> > void
> > CloseInput (void)
> > {
> > +  KdCloseInput();
> > }
> > 
> > #ifdef DDXBEFORERESET
> > diff --git a/hw/kdrive/fake/fakeinit.c b/hw/kdrive/fake/fakeinit.c
> > index ba61959..e25093f 100644
> > --- a/hw/kdrive/fake/fakeinit.c
> > +++ b/hw/kdrive/fake/fakeinit.c
> > @@ -61,6 +61,7 @@ InitInput (int argc, char **argv)
> > void
> > CloseInput (void)
> > {
> > +    KdCloseInput ();
> > }
> > 
> > #ifdef DDXBEFORERESET
> > diff --git a/hw/kdrive/fbdev/fbinit.c b/hw/kdrive/fbdev/fbinit.c
> > index 51e7e00..d822421 100644
> > --- a/hw/kdrive/fbdev/fbinit.c
> > +++ b/hw/kdrive/fbdev/fbinit.c
> > @@ -47,6 +47,7 @@ InitInput (int argc, char **argv)
> > void
> > CloseInput (void)
> > {
> > +    KdCloseInput ();
> > }
> > 
> > void
> > diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
> > index 2ab535a..8a7702e 100644
> > --- a/hw/kdrive/src/kdrive.h
> > +++ b/hw/kdrive/src/kdrive.h
> > @@ -500,6 +500,8 @@ KdScreenInfoDispose (KdScreenInfo *si);
> > /* kinput.c */
> > void
> > KdInitInput(void);
> > +void
> > +KdCloseInput(void);
> > 
> > void
> > KdAddPointerDriver(KdPointerDriver *);
> > diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
> > index cdf55d7..4e2c282 100644
> > --- a/hw/kdrive/src/kinput.c
> > +++ b/hw/kdrive/src/kinput.c
> > @@ -1305,6 +1305,12 @@ KdInitInput (void)
> >     mieqInit();
> > }
> > 
> > +void
> > +KdCloseInput (void)
> > +{
> > +    mieqFini();
> > +}
> > +
> > /*
> >  * Middle button emulation state machine
> >  *
> > diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
> > index 60b59c1..8836bbd 100644
> > --- a/hw/vfb/InitInput.c
> > +++ b/hw/vfb/InitInput.c
> > @@ -148,4 +148,5 @@ InitInput(int argc, char *argv[])
> > void
> > CloseInput (void)
> > {
> > +    mieqFini();
> > }
> > diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
> > index 53f763a..15fdbc3 100644
> > --- a/hw/xfree86/common/xf86Init.c
> > +++ b/hw/xfree86/common/xf86Init.c
> > @@ -825,6 +825,7 @@ void
> > CloseInput (void)
> > {
> >     config_fini();
> > +    mieqFini();
> > }
> > 
> > /*
> > diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
> > index ee74101..ea0669a 100644
> > --- a/hw/xnest/Init.c
> > +++ b/hw/xnest/Init.c
> > @@ -108,6 +108,7 @@ InitInput(int argc, char *argv[])
> > void
> > CloseInput(void)
> > {
> > +  mieqFini();
> > }
> > 
> > /*
> > diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
> > index 29ab836..73685b0 100644
> > --- a/hw/xquartz/darwin.c
> > +++ b/hw/xquartz/darwin.c
> > @@ -505,6 +505,10 @@ void InitInput( int argc, char **argv )
> >     QuartzInitInput(argc, argv);
> > }
> > 
> > +void CloseInput(void)
> > +{
> > +    DarwinEQFini();
> > +}
> > 
> > /*
> >  * DarwinAdjustScreenOrigins
> > diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
> > index fe744b7..1f22099 100644
> > --- a/hw/xquartz/darwinEvents.c
> > +++ b/hw/xquartz/darwinEvents.c
> > @@ -371,6 +371,10 @@ Bool DarwinEQInit(void) {
> >     return TRUE;
> > }
> > 
> > +Bool DarwinEQFini(void) {
> > +    mieqFini();
> > +}
> > +
> > /*
> >  * ProcessInputEvents
> >  *  Read and process events from the event queue until it is empty.
> > diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
> > index 6769c8b..bd29d51 100644
> > --- a/hw/xquartz/darwinEvents.h
> > +++ b/hw/xquartz/darwinEvents.h
> > @@ -32,6 +32,7 @@
> > #define XQUARTZ_VALUATOR_LIMIT (1 << 16)
> > 
> > Bool DarwinEQInit(void);
> > +Bool DarwinEQFini(void);
> > void DarwinEQEnqueue(const xEventPtr e);
> > void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
> > void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
> > diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c
> > index 70578b1..bc48a93 100644
> > --- a/hw/xwin/InitInput.c
> > +++ b/hw/xwin/InitInput.c
> > @@ -156,4 +156,5 @@ InitInput (int argc, char *argv[])
> > void
> > CloseInput (void)
> > {
> > +  mieqFini ();
> > }
> > -- 
> > 1.7.5.4
> > 
> 
> 


More information about the xorg-devel mailing list