[PATCH] randr: set error numbers of resource types in RRExtenstionInit() #30367

jamey at minilop.net jamey at minilop.net
Wed Sep 29 17:37:35 PDT 2010


Since I think I introduced this bug in the 1.9 cycle, I'd guess this
patch should be cherry-picked to the 1.9 stable branch too.

Jamey

On Tue, Sep 28, 2010 at 9:44 AM, Tobias Droste <tdroste at gmx.de> wrote:
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=30367
>
> Currently the ddx calls RROutputInit() before RRExtensionInit() is
> called. This causes RRErrorBase being 0 while setting resource type
> error (resource types RROutput, RRMode and RRCrtc).
> The fix moves the setting of error numbers to RRExtensionInit() to get
> the right RRErrorBase.
>
> Signed-off-by: Tobias Droste <tdroste at gmx.de>
> ---
>  randr/randr.c    |    5 +++++
>  randr/rrcrtc.c   |   11 ++++++++++-
>  randr/rrmode.c   |   14 +++++++++++++-
>  randr/rroutput.c |   11 ++++++++++-
>  4 files changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/randr/randr.c b/randr/randr.c
> index f52a46a..6077705 100644
> --- a/randr/randr.c
> +++ b/randr/randr.c
> @@ -354,6 +354,11 @@ RRExtensionInit (void)
>        SRRScreenChangeNotifyEvent;
>     EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
>        SRRNotifyEvent;
> +
> +    RRModeInitErrorValue();
> +    RRCrtcInitErrorValue();
> +    RROutputInitErrorValue();
> +
>  #ifdef PANORAMIX
>     RRXineramaExtensionInit();
>  #endif
> diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
> index 14f6e45..839f3cd 100644
> --- a/randr/rrcrtc.c
> +++ b/randr/rrcrtc.c
> @@ -631,10 +631,19 @@ RRCrtcInit (void)
>     RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC");
>     if (!RRCrtcType)
>        return FALSE;
> -    SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
> +
>     return TRUE;
>  }
>
> +/*
> + * Initialize crtc type error value
> + */
> +void
> +RRCrtcInitErrorValue()
> +{
> +    SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
> +}
> +
>  int
>  ProcRRGetCrtcInfo (ClientPtr client)
>  {
> diff --git a/randr/rrmode.c b/randr/rrmode.c
> index deddd3c..361d17d 100644
> --- a/randr/rrmode.c
> +++ b/randr/rrmode.c
> @@ -260,6 +260,9 @@ RRModeDestroyResource (pointer value, XID pid)
>     return 1;
>  }
>
> +/*
> + * Initialize mode type
> + */
>  Bool
>  RRModeInit (void)
>  {
> @@ -268,10 +271,19 @@ RRModeInit (void)
>     RRModeType = CreateNewResourceType (RRModeDestroyResource, "MODE");
>     if (!RRModeType)
>        return FALSE;
> -    SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode);
> +
>     return TRUE;
>  }
>
> +/*
> + * Initialize mode type error value
> + */
> +void
> +RRModeInitErrorValue()
> +{
> +    SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode);
> +}
> +
>  int
>  ProcRRCreateMode (ClientPtr client)
>  {
> diff --git a/randr/rroutput.c b/randr/rroutput.c
> index 937b14d..1d65c11 100644
> --- a/randr/rroutput.c
> +++ b/randr/rroutput.c
> @@ -418,10 +418,19 @@ RROutputInit (void)
>     RROutputType = CreateNewResourceType (RROutputDestroyResource, "OUTPUT");
>     if (!RROutputType)
>        return FALSE;
> -    SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput);
> +
>     return TRUE;
>  }
>
> +/*
> + * Initialize output type error value
> + */
> +void
> +RROutputInitErrorValue()
> +{
> +    SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput);
> +}
> +
>  #define OutputInfoExtra        (SIZEOF(xRRGetOutputInfoReply) - 32)
>
>  int
> --
> 1.7.1
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>


More information about the xorg-devel mailing list