mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-28 11:35:35 +03:00
GH-339 Use autorelease pool in the callbacks to be sure
This commit is contained in:
parent
3a61567590
commit
3d4867c232
@ -14,7 +14,6 @@
|
||||
#import "NeoVimTab.h"
|
||||
#import "CocoaCategories.h"
|
||||
#import "DataWrapper.h"
|
||||
#import "vim.h"
|
||||
|
||||
// FileInfo and Boolean are #defined by Carbon and NeoVim: Since we don't need the Carbon versions of them, we rename
|
||||
// them.
|
||||
@ -512,11 +511,11 @@ void quit_neovim() {
|
||||
}
|
||||
|
||||
#pragma mark Functions for neovim's main loop
|
||||
// already in an autorelease pool and in neovim's main loop
|
||||
|
||||
typedef NSData *(^work_block)(NSData *);
|
||||
|
||||
static void work_and_write_data_sync(void **argv, work_block block) {
|
||||
@autoreleasepool {
|
||||
NSCondition *outputCondition = argv[1];
|
||||
[outputCondition lock];
|
||||
|
||||
@ -528,6 +527,15 @@ static void work_and_write_data_sync(void **argv, work_block block) {
|
||||
|
||||
[outputCondition signal];
|
||||
[outputCondition unlock];
|
||||
}
|
||||
}
|
||||
|
||||
static void work_async(void **argv, work_block block) {
|
||||
@autoreleasepool {
|
||||
NSData *data = argv[0];
|
||||
block(data);
|
||||
[data release]; // retained in local_server_callback
|
||||
}
|
||||
}
|
||||
|
||||
static NSString *escaped_filename(NSString *filename) {
|
||||
@ -540,12 +548,6 @@ static NSString *escaped_filename(NSString *filename) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static void work_async(void **argv, work_block block) {
|
||||
NSData *data = argv[0];
|
||||
block(data);
|
||||
[data release]; // retained in local_server_callback
|
||||
}
|
||||
|
||||
static NeoVimBuffer *buffer_for(buf_T *buf) {
|
||||
// To be sure...
|
||||
if (buf == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user