GNU bug report logs -
#23856
25.0.95; Crash on cancel print dialogue
Previous Next
Reported by: Alf Lervåg <alf <at> lervag.net>
Date: Mon, 27 Jun 2016 19:06:01 UTC
Severity: normal
Tags: confirmed, patch
Found in version 25.0.95
Done: Alan Third <alan <at> idiocy.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
* src/nsmenu.m (pop_down_menu, ns_popup_dialog): Remove references to
autorelease pool and Popdown_data struct.
---
src/nsmenu.m | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 7d340e8..12af38b 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1426,29 +1426,19 @@ - (NSRect) frame
========================================================================== */
-struct Popdown_data
-{
- NSAutoreleasePool *pool;
- EmacsDialogPanel *dialog;
-};
-
static void
pop_down_menu (void *arg)
{
- struct Popdown_data *unwind_data = arg;
+ EmacsDialogPanel *panel = arg;
- block_input ();
if (popup_activated_flag)
{
- EmacsDialogPanel *panel = unwind_data->dialog;
+ block_input ();
popup_activated_flag = 0;
[panel close];
- [unwind_data->pool release];
[[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
+ unblock_input ();
}
-
- xfree (unwind_data);
- unblock_input ();
}
@@ -1459,7 +1449,6 @@ - (NSRect) frame
Lisp_Object tem, title;
NSPoint p;
BOOL isQ;
- NSAutoreleasePool *pool;
NSTRACE ("ns_popup_dialog");
@@ -1479,18 +1468,13 @@ - (NSRect) frame
contents = list2 (title, Fcons (build_string ("Ok"), Qt));
block_input ();
- pool = [[NSAutoreleasePool alloc] init];
dialog = [[EmacsDialogPanel alloc] initFromContents: contents
isQuestion: isQ];
{
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
- struct Popdown_data *unwind_data = xmalloc (sizeof (*unwind_data));
-
- unwind_data->pool = pool;
- unwind_data->dialog = dialog;
- record_unwind_protect_ptr (pop_down_menu, unwind_data);
+ record_unwind_protect_ptr (pop_down_menu, dialog);
popup_activated_flag = 1;
tem = [dialog runDialogAt: p];
unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */
--
I'm unsure what the purpose of this autorelease pool is. I guess it's
supposed to be so that the dialog object always get released
correctly, but it seems to be broken.
I've just removed it, which I guess may introduce a memory leak, but I
don't know how to check.
--
Alan Third
This bug report was last modified 8 years and 309 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.