diff options
author | Dave Airlie <airlied@redhat.com> | 2013-01-09 12:58:28 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-03-01 18:14:28 +1000 |
commit | 8f4640bdb9d3988148e09a08d2c7e3bab1d538d6 (patch) | |
tree | 965b9a262246c80d860fe8ebb5fb9ceeb6c910fd /randr | |
parent | 3ec35c45ca17f5ed6fd02c50fc49ae7b8d128dcb (diff) |
randr: cleanup provider properly
So in the cold plug server shutdown case, we reap the resources
before we call CloseScreen handlers, so the config->randr_provider
is a dangling pointer when the xf86CrtcCloseScreen handler is called,
however in the hot screen unplug case, we can't rely on automatically
reaped resources, so we need to clean up the provider in the xf86CrtcCloseScreen
case.
This patch provides a cleanup callback from the randr provider removal
into the DDX so it can cleanup properly, this then gets called by the automatic
code for cold plug, or if hot unplug it gets called explicitly.
Fixes a number of random server crashes on shutdown
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58174
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=891140
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'randr')
-rw-r--r-- | randr/randrstr.h | 6 | ||||
-rw-r--r-- | randr/rrprovider.c | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/randr/randrstr.h b/randr/randrstr.h index f52d0f284..25174798f 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -232,6 +232,9 @@ typedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen, RRProviderPtr offload_sink); +typedef void (*RRProviderDestroyProcPtr)(ScreenPtr pScreen, + RRProviderPtr provider); + /* These are for 1.0 compatibility */ typedef struct _rrRefresh { @@ -330,6 +333,9 @@ typedef struct _rrScrPriv { Bool discontiguous; RRProviderPtr provider; + + RRProviderDestroyProcPtr rrProviderDestroy; + } rrScrPrivRec, *rrScrPrivPtr; extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec; diff --git a/randr/rrprovider.c b/randr/rrprovider.c index c4ed515d6..b321e6227 100644 --- a/randr/rrprovider.c +++ b/randr/rrprovider.c @@ -389,6 +389,8 @@ RRProviderDestroyResource (pointer value, XID pid) { rrScrPriv(pScreen); + if (pScrPriv->rrProviderDestroy) + (*pScrPriv->rrProviderDestroy)(pScreen, provider); pScrPriv->provider = NULL; } free(provider); |