This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
shell/platform/darwin/ios Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 6
6
#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_PLATFORM_MESSAGE_HANDLER_IOS_H_
7
7
8
8
#include " flutter/fml/platform/darwin/scoped_block.h"
9
+ #include " flutter/fml/platform/darwin/scoped_nsobject.h"
9
10
#include " flutter/fml/task_runner.h"
10
11
#include " flutter/shell/common/platform_message_handler.h"
11
12
#import " flutter/shell/platform/darwin/ios/flutter_task_queue_dispatch.h"
@@ -32,7 +33,7 @@ class PlatformMessageHandlerIos : public PlatformMessageHandler {
32
33
NSObject <FlutterTaskQueue>* task_queue);
33
34
34
35
struct HandlerInfo {
35
- NSObject <FlutterTaskQueueDispatch>* task_queue;
36
+ fml::scoped_nsprotocol< NSObject <FlutterTaskQueueDispatch>*> task_queue;
36
37
fml::ScopedBlock<FlutterBinaryMessageHandler> handler;
37
38
};
38
39
Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ - (void)dispatch:(dispatch_block_t)block {
80
80
});
81
81
};
82
82
83
- if (handler_info.task_queue ) {
84
- [handler_info.task_queue dispatch: run_handler];
83
+ if (handler_info.task_queue . get () ) {
84
+ [handler_info.task_queue. get () dispatch: run_handler];
85
85
} else {
86
86
dispatch_async (dispatch_get_main_queue (), run_handler);
87
87
}
@@ -124,7 +124,8 @@ - (void)dispatch:(dispatch_block_t)block {
124
124
message_handlers_.erase (channel);
125
125
if (handler) {
126
126
message_handlers_[channel] = {
127
- .task_queue = (NSObject <FlutterTaskQueueDispatch>*)task_queue,
127
+ .task_queue =
128
+ fml::scoped_nsprotocol (static_cast <NSObject <FlutterTaskQueueDispatch>*>(task_queue)),
128
129
.handler =
129
130
fml::ScopedBlock<FlutterBinaryMessageHandler>{
130
131
handler, fml::scoped_policy::OwnershipPolicy::kRetain },
You can’t perform that action at this time.
0 commit comments