diff options
| author | Alan Third | 2016-06-29 20:17:18 +0100 |
|---|---|---|
| committer | Alan Third | 2016-07-17 22:16:43 +0100 |
| commit | 02ca5db040b57ca4a36c317fcb3fb56f43ab371e (patch) | |
| tree | 57179c98f4b525fdade4985e113947ab0b5113d8 /src/nsmenu.m | |
| parent | 001d88b62ecb8163a148656acb103b354ce7613a (diff) | |
| download | emacs-02ca5db040b57ca4a36c317fcb3fb56f43ab371e.tar.gz emacs-02ca5db040b57ca4a36c317fcb3fb56f43ab371e.zip | |
Remove separate pool for popup dialogs (bug#23856)
* src/nsmenu.m (pop_down_menu, ns_popup_dialog): Remove references to
autorelease pool and Popdown_data struct.
Diffstat (limited to 'src/nsmenu.m')
| -rw-r--r-- | src/nsmenu.m | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/nsmenu.m b/src/nsmenu.m index 10dfe8aac13..83ded6daca3 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -1420,29 +1420,19 @@ update_frame_tool_bar (struct frame *f) | |||
| 1420 | 1420 | ||
| 1421 | ========================================================================== */ | 1421 | ========================================================================== */ |
| 1422 | 1422 | ||
| 1423 | struct Popdown_data | ||
| 1424 | { | ||
| 1425 | NSAutoreleasePool *pool; | ||
| 1426 | EmacsDialogPanel *dialog; | ||
| 1427 | }; | ||
| 1428 | |||
| 1429 | static void | 1423 | static void |
| 1430 | pop_down_menu (void *arg) | 1424 | pop_down_menu (void *arg) |
| 1431 | { | 1425 | { |
| 1432 | struct Popdown_data *unwind_data = arg; | 1426 | EmacsDialogPanel *panel = arg; |
| 1433 | 1427 | ||
| 1434 | block_input (); | ||
| 1435 | if (popup_activated_flag) | 1428 | if (popup_activated_flag) |
| 1436 | { | 1429 | { |
| 1437 | EmacsDialogPanel *panel = unwind_data->dialog; | 1430 | block_input (); |
| 1438 | popup_activated_flag = 0; | 1431 | popup_activated_flag = 0; |
| 1439 | [panel close]; | 1432 | [panel close]; |
| 1440 | [unwind_data->pool release]; | ||
| 1441 | [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; | 1433 | [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; |
| 1434 | unblock_input (); | ||
| 1442 | } | 1435 | } |
| 1443 | |||
| 1444 | xfree (unwind_data); | ||
| 1445 | unblock_input (); | ||
| 1446 | } | 1436 | } |
| 1447 | 1437 | ||
| 1448 | 1438 | ||
| @@ -1453,7 +1443,6 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) | |||
| 1453 | Lisp_Object tem, title; | 1443 | Lisp_Object tem, title; |
| 1454 | NSPoint p; | 1444 | NSPoint p; |
| 1455 | BOOL isQ; | 1445 | BOOL isQ; |
| 1456 | NSAutoreleasePool *pool; | ||
| 1457 | 1446 | ||
| 1458 | NSTRACE ("ns_popup_dialog"); | 1447 | NSTRACE ("ns_popup_dialog"); |
| 1459 | 1448 | ||
| @@ -1473,18 +1462,13 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) | |||
| 1473 | contents = list2 (title, Fcons (build_string ("Ok"), Qt)); | 1462 | contents = list2 (title, Fcons (build_string ("Ok"), Qt)); |
| 1474 | 1463 | ||
| 1475 | block_input (); | 1464 | block_input (); |
| 1476 | pool = [[NSAutoreleasePool alloc] init]; | ||
| 1477 | dialog = [[EmacsDialogPanel alloc] initFromContents: contents | 1465 | dialog = [[EmacsDialogPanel alloc] initFromContents: contents |
| 1478 | isQuestion: isQ]; | 1466 | isQuestion: isQ]; |
| 1479 | 1467 | ||
| 1480 | { | 1468 | { |
| 1481 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); | 1469 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 1482 | struct Popdown_data *unwind_data = xmalloc (sizeof (*unwind_data)); | ||
| 1483 | |||
| 1484 | unwind_data->pool = pool; | ||
| 1485 | unwind_data->dialog = dialog; | ||
| 1486 | 1470 | ||
| 1487 | record_unwind_protect_ptr (pop_down_menu, unwind_data); | 1471 | record_unwind_protect_ptr (pop_down_menu, dialog); |
| 1488 | popup_activated_flag = 1; | 1472 | popup_activated_flag = 1; |
| 1489 | tem = [dialog runDialogAt: p]; | 1473 | tem = [dialog runDialogAt: p]; |
| 1490 | unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ | 1474 | unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ |