emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9664b8c8e1: Fix selection preservation bug when USE_XCB


From: Paul Eggert
Subject: master 9664b8c8e1: Fix selection preservation bug when USE_XCB
Date: Sun, 14 Aug 2022 14:14:24 -0400 (EDT)

branch: master
commit 9664b8c8e1724af159913c511203e31f0e7d845e
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Fix selection preservation bug when USE_XCB
    
    * src/xterm.c (x_preserve_selections) [USE_XCB]: Fix bug: use of
    wrong ‘tem’ value.  Found by GCC -Wanalyzer-use-of-uninitialized-value.
    Move decl of local to make the (former) bug more obvious.
---
 src/xterm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 6cf44e162b..5047f3066b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -29140,7 +29140,7 @@ void
 x_preserve_selections (struct x_display_info *dpyinfo, Lisp_Object lost,
                       Lisp_Object current_owner)
 {
-  Lisp_Object tail, frame, new_owner, tem;
+  Lisp_Object tail, frame, new_owner;
   Time timestamp;
   Window *owners;
   Atom *names;
@@ -29170,7 +29170,7 @@ x_preserve_selections (struct x_display_info *dpyinfo, 
Lisp_Object lost,
 
   FOR_EACH_TAIL_SAFE (tail)
     {
-      tem = XCAR (tail);
+      Lisp_Object tem = XCAR (tail);
       ++nowners;
 
       /* The selection is really lost (since we cannot find a new
@@ -29204,7 +29204,7 @@ x_preserve_selections (struct x_display_info *dpyinfo, 
Lisp_Object lost,
 
       FOR_EACH_TAIL_SAFE (tail)
        {
-         tem = XCAR (tail);
+         Lisp_Object tem = XCAR (tail);
 
          /* Now check if we still don't own that selection, which can
             happen if another program set itself as the owner.  */
@@ -29224,9 +29224,10 @@ x_preserve_selections (struct x_display_info *dpyinfo, 
Lisp_Object lost,
 
       FOR_EACH_TAIL_SAFE (tail)
        {
+         Lisp_Object tem = XCAR (tail);
+
          reply = xcb_get_selection_owner_reply (dpyinfo->xcb_connection,
                                                 cookies[nowners++], &error);
-
          if (reply)
            owners[nowners - 1] = reply->owner;
          else
@@ -29256,7 +29257,7 @@ x_preserve_selections (struct x_display_info *dpyinfo, 
Lisp_Object lost,
 
       FOR_EACH_TAIL_SAFE (tail)
        {
-         tem = XCAR (tail);
+         Lisp_Object tem = XCAR (tail);
 
          /* If the selection isn't owned by us anymore, note that the
             selection was lost.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]