Merge from savannah/emacs-30

2d5cf22818 Fix clipboard object handle leak on Android 3.1 to 11.0
b6b4a080a3 Only disable 'completion-preview-active-mode' when it is on
This commit is contained in:
Po Lu 2025-03-16 20:16:05 +08:00
commit a07465410a
2 changed files with 19 additions and 9 deletions

View file

@ -615,14 +615,18 @@ point, otherwise hide it."
(cancel-timer completion-preview--timer)
(setq completion-preview--timer nil))
;; If we're called after a command that itself updates the
;; preview, don't do anything.
(unless internal-p
(if (and (completion-preview-require-certain-commands)
(completion-preview-require-minimum-symbol-length)
(not buffer-read-only))
(completion-preview--show)
(completion-preview-active-mode -1)))))
(cond
(internal-p
;; `this-command' took care of updating the preview. Do nothing.
)
((and (completion-preview-require-certain-commands)
(completion-preview-require-minimum-symbol-length)
(not buffer-read-only))
;; All conditions met. Show or update the preview.
(completion-preview--show))
(completion-preview-active-mode
;; The preview is shown, but it shouldn't be. Hide it.
(completion-preview-active-mode -1)))))
(defun completion-preview--barf-if-no-preview ()
"Signal a `user-error' if completion preview is not active."

View file

@ -418,7 +418,10 @@ close_asset_fd (void *afd)
}
/* Return the offset, file descriptor and length of the data contained
in the asset file descriptor AFD, in *FD, *OFFSET, and *LENGTH.
in the asset file descriptor AFD, in *FD, *OFFSET, and *LENGTH. AFD
will not be released if an exception is detected; it is the
responsibility of the caller to arrange that it be.
Value is 0 upon success, 1 otherwise. */
static int
@ -487,6 +490,9 @@ extract_fd_offsets (jobject afd, int *fd, jlong *offset, jlong *length)
*fd = (*android_java_env)->CallIntMethod (android_java_env,
java_fd,
fd_class.get_fd);
android_exception_check_1 (java_fd);
ANDROID_DELETE_LOCAL_REF (java_fd);
if (*fd >= 0)
return 0;
}