[PATCH] fonts: Fix Xinerama sleep logic

Adam Jackson ajax at redhat.com
Fri Aug 30 07:55:51 PDT 2013


I introduced this bug, and I have no idea what I was thinking.  The
xinerama_sleep label I introduced is actually the closure cleanup path.
What you actually want to do is re-queue the work, which is spelled
ClientSignal.

To reproduce this bug, add a font server to your font path, run xfontsel,
and watch your X server crash.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 dix/dixfonts.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index feb765d..1841611 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -315,7 +315,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
             if (!ClientIsAsleep(client))
                 ClientSleep(client, (ClientSleepProcPtr) doOpenFont, c);
             else
-                goto xinerama_sleep;
+                ClientSignal(client);
             return TRUE;
         }
         break;
@@ -363,7 +363,6 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
                           c->fontid, FontToXError(err));
     }
     ClientWakeup(c->client);
- xinerama_sleep:
     for (i = 0; i < c->num_fpes; i++) {
         FreeFPE(c->fpe_list[i]);
     }
@@ -597,7 +596,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                     ClientSleep(client,
                                 (ClientSleepProcPtr) doListFontsAndAliases, c);
                 else
-                    goto xinerama_sleep;
+                    ClientSignal(client);
                 return TRUE;
             }
 
@@ -624,7 +623,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                                     (ClientSleepProcPtr) doListFontsAndAliases,
                                     c);
                     else
-                        goto xinerama_sleep;
+                        ClientSignal(client);
                     return TRUE;
                 }
                 if (err == Successful)
@@ -643,7 +642,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                                     (ClientSleepProcPtr) doListFontsAndAliases,
                                     c);
                     else
-                        goto xinerama_sleep;
+                        ClientSignal(client);
                     return TRUE;
                 }
                 if (err == FontNameAlias) {
@@ -788,7 +787,6 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 
  bail:
     ClientWakeup(client);
- xinerama_sleep:
     for (i = 0; i < c->num_fpes; i++)
         FreeFPE(c->fpe_list[i]);
     free(c->fpe_list);
@@ -889,7 +887,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
                     ClientSleep(client,
                                 (ClientSleepProcPtr) doListFontsWithInfo, c);
                 else
-                    goto xinerama_sleep;
+                    ClientSignal(client);
                 return TRUE;
             }
             if (err == Successful)
@@ -906,7 +904,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
                     ClientSleep(client,
                                 (ClientSleepProcPtr) doListFontsWithInfo, c);
                 else
-                    goto xinerama_sleep;
+                    ClientSignal(client);
                 return TRUE;
             }
         }
@@ -1040,7 +1038,6 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
     WriteSwappedDataToClient(client, length, &finalReply);
  bail:
     ClientWakeup(client);
- xinerama_sleep:
     for (i = 0; i < c->num_fpes; i++)
         FreeFPE(c->fpe_list[i]);
     free(c->reply);
@@ -1298,7 +1295,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
                     continue;   /* on to steps 3 and 4 */
                 }
                 else
-                    goto xinerama_sleep;
+                    ClientSignal(client);
                 return TRUE;
             }
             else if (lgerr != Successful) {
@@ -1352,7 +1349,6 @@ doPolyText(ClientPtr client, PTclosurePtr c)
     }
     if (ClientIsAsleep(client)) {
         ClientWakeup(c->client);
- xinerama_sleep:
         ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
 
         /* Unreference the font from the scratch GC */
@@ -1473,7 +1469,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
             ClientSleep(client, (ClientSleepProcPtr) doImageText, c);
         }
         else
-            goto xinerama_sleep;
+            ClientSignal(client);
         return TRUE;
     }
     else if (lgerr != Successful) {
@@ -1496,7 +1492,6 @@ doImageText(ClientPtr client, ITclosurePtr c)
     }
     if (ClientIsAsleep(client)) {
         ClientWakeup(c->client);
- xinerama_sleep:
         ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
 
         /* Unreference the font from the scratch GC */
-- 
1.8.3.1



More information about the xorg-devel mailing list