kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=7e245b0c64d89571ed3cef823f0ccffc7440f13f

commit 7e245b0c64d89571ed3cef823f0ccffc7440f13f
Author: Kim Woelders <[email protected]>
Date:   Sun May 11 14:04:25 2014 +0200

    Avoid some potential X-calls/errors when client is destroyed.
---
 src/ewins.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/ewins.c b/src/ewins.c
index cbd5ace..347d1a7 100644
--- a/src/ewins.c
+++ b/src/ewins.c
@@ -1116,6 +1116,7 @@ static void
 EwinWithdraw(EWin * ewin, Win to)
 {
    int                 x, y;
+   EX_Window           xwin;
 
    /* Only external clients should go here */
 
@@ -1125,10 +1126,16 @@ EwinWithdraw(EWin * ewin, Win to)
 
    EGrabServer();
 
+   xwin = EXWindowGetParent(EwinGetClientXwin(ewin));
+
+   /* Window may be destroyed after unmap but DestroyNotify not received yet */
+   if (xwin == NoXID)
+      goto done;
+
    ESelectInput(EwinGetClientWin(ewin), NoEventMask);
    XShapeSelectInput(disp, EwinGetClientXwin(ewin), NoEventMask);
 
-   if (EXWindowGetParent(EwinGetClientXwin(ewin)) == 
EwinGetContainerXwin(ewin))
+   if (xwin == EwinGetContainerXwin(ewin))
      {
        /* Park the client window on the new root */
        x = ewin->client.x;
@@ -1142,6 +1149,8 @@ EwinWithdraw(EWin * ewin, Win to)
    ICCCM_Withdraw(ewin);
 
    ESync(0);
+
+ done:
    EUngrabServer();
 }
 

-- 


Reply via email to