Browse Source

Fix memory leak in `org-agenda-prepare-buffers'

* lisp/org.el (org-agenda-prepare-buffers): Do not use
  `org-uniquify-alist' since it uses `eq' for comparison, whereas where
  are using strings as keys.

Reported-by: Vincent Emanuele <vincent.emanuele@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/104196>
Nicolas Goaziou 4 years ago
parent
commit
ce80a0e727
1 changed files with 8 additions and 4 deletions
  1. 8 4
      lisp/org.el

+ 8 - 4
lisp/org.el

@@ -18755,10 +18755,14 @@ When a buffer is unmodified, it is just killed.  When modified, it is saved
 		   (append org-tag-alist-for-agenda
 			   org-tag-alist
 			   org-tag-persistent-alist)))
-	    (if org-group-tags
-		(setq org-tag-groups-alist-for-agenda
-		      (org-uniquify-alist
-		       (append org-tag-groups-alist-for-agenda org-tag-groups-alist))))
+	    ;; Merge current file's tag groups into global
+	    ;; `org-tag-groups-alist-for-agenda'.
+	    (when org-group-tags
+	      (dolist (alist org-tag-groups-alist)
+		(let ((old (assoc (car alist) org-tag-groups-alist-for-agenda)))
+		  (if old
+		      (setcdr old (org-uniquify (append (cdr old) (cdr alist))))
+		    (push alist org-tag-groups-alist-for-agenda)))))
 	    (org-with-silent-modifications
 	     (save-excursion
 	       (remove-text-properties (point-min) (point-max) pall)