summaryrefslogtreecommitdiff
path: root/randr
diff options
context:
space:
mode:
authorAlex Goins <agoins@nvidia.com>2020-07-02 18:39:11 -0500
committerAlex Goins <agoins@nvidia.com>2020-07-21 15:53:53 +0000
commit6172bd2b41a7ce158b9052af3e373318e5e4381c (patch)
treef5be87b5b46e3ad253951d19d401360f49e93fdc /randr
parente33453f9111b21e4814d628e6ae00bc7b200f404 (diff)
randr: Check rrPrivKey before autobinding GPU screens
RRProviderAutoConfigGpuScreen() is called from outside RandR, so there is no guarantee that RandR has been initialized when it is called. As mentioned in commit 4226c6d, it's possible that RandR has not been initialized if the server is configured with Xinerama and there is more than one X screen. Calling rrGetScrPriv when RandR isn't initialized causes an assertion failure that aborts the server: Xorg: ../include/privates.h:121: dixGetPrivateAddr: Assertion key->initialized' failed. Just as in commit 4226c6d, fix the problem by checking dixPrivateKeyRegistered(rrPrivKey) before calling rrGetScrPriv. Signed-off-by: Alex Goins <agoins@nvidia.com>
Diffstat (limited to 'randr')
-rw-r--r--randr/rrprovider.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/randr/rrprovider.c b/randr/rrprovider.c
index 217aead56..617185cf7 100644
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -490,10 +490,20 @@ RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider)
void
RRProviderAutoConfigGpuScreen(ScreenPtr pScreen, ScreenPtr primaryScreen)
{
- rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
- rrScrPrivPtr primaryPriv = rrGetScrPriv(primaryScreen);
- RRProviderPtr provider = pScrPriv->provider;
- RRProviderPtr primary_provider = primaryPriv->provider;
+ rrScrPrivPtr pScrPriv;
+ rrScrPrivPtr primaryPriv;
+ RRProviderPtr provider;
+ RRProviderPtr primary_provider;
+
+ /* Bail out if RandR wasn't initialized. */
+ if (!dixPrivateKeyRegistered(rrPrivKey))
+ return;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ primaryPriv = rrGetScrPriv(primaryScreen);
+
+ provider = pScrPriv->provider;
+ primary_provider = primaryPriv->provider;
if (!provider || !primary_provider)
return;