aboutsummaryrefslogtreecommitdiffstats
path: root/src/androidmenu.c
diff options
context:
space:
mode:
authorPo Lu2023-10-04 16:33:05 +0800
committerPo Lu2023-10-04 16:33:05 +0800
commitbb417daa703b0dd8871470ce53a40b16b1ca300b (patch)
treee826d39aef4b622acfdc9c77a4b581dbab447fab /src/androidmenu.c
parentfbfdd1e0e3e67f765c6dbf9f61b5f913e55e004e (diff)
downloademacs-bb417daa703b0dd8871470ce53a40b16b1ca300b.tar.gz
emacs-bb417daa703b0dd8871470ce53a40b16b1ca300b.zip
Correct local reference leaks
* src/android.c (android_build_string): Accept a list of local references to destroy upon an allocation failure, facilitating the proper deallocation of local references in such situations. (android_browse_url): Revise for new calling convention. * src/android.h (android_build_string): Update declaration correspondingly. * src/androidmenu.c (android_menu_show, android_dialog_show): Revise for new calling convention. * src/androidselect.c (android_notifications_notify_1): Supply each successive local reference to android_build_string as notification text is being encoded. * src/androidvfs.c (android_saf_exception_check): Introduce absent va_end.
Diffstat (limited to 'src/androidmenu.c')
-rw-r--r--src/androidmenu.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/androidmenu.c b/src/androidmenu.c
index ed26bdafa85..1f4d91b527d 100644
--- a/src/androidmenu.c
+++ b/src/androidmenu.c
@@ -278,7 +278,7 @@ android_menu_show (struct frame *f, int x, int y, int menuflags,
278 278
279 title_string = NULL; 279 title_string = NULL;
280 if (STRINGP (title) && menu_items_n_panes < 2) 280 if (STRINGP (title) && menu_items_n_panes < 2)
281 title_string = android_build_string (title); 281 title_string = android_build_string (title, NULL);
282 282
283 /* Push the first local frame for the context menu. */ 283 /* Push the first local frame for the context menu. */
284 method = menu_class.create_context_menu; 284 method = menu_class.create_context_menu;
@@ -370,7 +370,7 @@ android_menu_show (struct frame *f, int x, int y, int menuflags,
370 pane_name = Fsubstring (pane_name, make_fixnum (1), Qnil); 370 pane_name = Fsubstring (pane_name, make_fixnum (1), Qnil);
371 371
372 /* Add the pane. */ 372 /* Add the pane. */
373 temp = android_build_string (pane_name); 373 temp = android_build_string (pane_name, NULL);
374 android_exception_check (); 374 android_exception_check ();
375 375
376 (*env)->CallNonvirtualVoidMethod (env, current_context_menu, 376 (*env)->CallNonvirtualVoidMethod (env, current_context_menu,
@@ -399,7 +399,7 @@ android_menu_show (struct frame *f, int x, int y, int menuflags,
399 { 399 {
400 /* This is a submenu. Add it. */ 400 /* This is a submenu. Add it. */
401 title_string = (!NILP (item_name) 401 title_string = (!NILP (item_name)
402 ? android_build_string (item_name) 402 ? android_build_string (item_name, NULL)
403 : NULL); 403 : NULL);
404 help_string = NULL; 404 help_string = NULL;
405 405
@@ -408,7 +408,7 @@ android_menu_show (struct frame *f, int x, int y, int menuflags,
408 408
409 if (android_get_current_api_level () >= 26 409 if (android_get_current_api_level () >= 26
410 && STRINGP (help)) 410 && STRINGP (help))
411 help_string = android_build_string (help); 411 help_string = android_build_string (help, NULL);
412 412
413 store = current_context_menu; 413 store = current_context_menu;
414 current_context_menu 414 current_context_menu
@@ -443,7 +443,7 @@ android_menu_show (struct frame *f, int x, int y, int menuflags,
443 /* Add this menu item with the appropriate state. */ 443 /* Add this menu item with the appropriate state. */
444 444
445 title_string = (!NILP (item_name) 445 title_string = (!NILP (item_name)
446 ? android_build_string (item_name) 446 ? android_build_string (item_name, NULL)
447 : NULL); 447 : NULL);
448 help_string = NULL; 448 help_string = NULL;
449 449
@@ -452,7 +452,7 @@ android_menu_show (struct frame *f, int x, int y, int menuflags,
452 452
453 if (android_get_current_api_level () >= 26 453 if (android_get_current_api_level () >= 26
454 && STRINGP (help)) 454 && STRINGP (help))
455 help_string = android_build_string (help); 455 help_string = android_build_string (help, NULL);
456 456
457 /* Determine whether or not to display a check box. */ 457 /* Determine whether or not to display a check box. */
458 458
@@ -686,7 +686,7 @@ android_dialog_show (struct frame *f, Lisp_Object title,
686 : android_build_jstring ("Question")); 686 : android_build_jstring ("Question"));
687 687
688 /* And the title. */ 688 /* And the title. */
689 java_title = android_build_string (title); 689 java_title = android_build_string (title, NULL);
690 690
691 /* Now create the dialog. */ 691 /* Now create the dialog. */
692 method = dialog_class.create_dialog; 692 method = dialog_class.create_dialog;
@@ -738,7 +738,7 @@ android_dialog_show (struct frame *f, Lisp_Object title,
738 } 738 }
739 739
740 /* Add the button. */ 740 /* Add the button. */
741 temp = android_build_string (item_name); 741 temp = android_build_string (item_name, NULL);
742 (*env)->CallNonvirtualVoidMethod (env, dialog, 742 (*env)->CallNonvirtualVoidMethod (env, dialog,
743 dialog_class.class, 743 dialog_class.class,
744 dialog_class.add_button, 744 dialog_class.add_button,