alexmercerind / flutter_acrylic

Flutter library for window acrylic, mica & transparency effects.
MIT License
607 stars 54 forks source link

Fix warning message: NSWindow warning: adding an unknown subview: <NSVisualEffectView: 0x7fe74ef4d490>. Break on NSLog to debug. #11

Closed Adrian-Samoticha closed 3 years ago

Adrian-Samoticha commented 3 years ago

Currently, launching an app that has flutter_acrylic enabled on macOS causes the following warning message to be printed to the console:

2021-11-01 09:43:20.415804+0100 new_flutter_project[64015:19213583] NSWindow warning: adding an unknown subview: <NSVisualEffectView: 0x7fe74ef4d490>. Break on NSLog to debug.
2021-11-01 09:43:20.423862+0100 new_flutter_project[64015:19213583] Call stack:
(
    0   AppKit                              0x00007ff80b5daa26 -[NSThemeFrame addSubview:] + 112
    1   AppKit                              0x00007ff80b61d281 -[NSView replaceSubview:with:] + 154
    2   flutter_acrylic                     0x000000010b5fbc2a $s15flutter_acrylic28MainFlutterWindowManipulatorC11setMaterial8materialySo014NSVisualEffectH0V_tFZ + 1322
    3   flutter_acrylic                     0x000000010b5fbdf5 $s15flutter_acrylic28MainFlutterWindowManipulatorC9setEffect8materialySo08NSVisualH8MaterialV_tFZ + 37
    4   flutter_acrylic                     0x000000010b5fcb1a $s15flutter_acrylic20FlutterAcrylicPluginC6handle_6resultySo0C10MethodCallC_yypSgctF + 1050
    5   flutter_acrylic                     0x000000010b5fd9b6 $s15flutter_acrylic20FlutterAcrylicPluginC6handle_6resultySo0C10MethodCallC_yypSgctFTo + 118
    6   FlutterMacOS                        0x000000010e4190ad __56-[FlutterEngineRegistrar addMethodCallDelegate:channel:]_block_invoke + 45
    7   FlutterMacOS                        0x000000010f006a97 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 119
    8   FlutterMacOS                        0x000000010e41b6a1 -[FlutterEngine engineCallbackOnPlatformMessage:] + 289
    9   FlutterMacOS                        0x000000010e419eac _ZL17OnPlatformMessagePK22FlutterPlatformMessageP13FlutterEngine + 44
    10  FlutterMacOS                        0x000000010ec52fbd _ZNSt3__110__function6__funcIZ23FlutterEngineInitializeE4$_49NS_9allocatorIS2_EEFvNS_10unique_ptrIN7flutter15PlatformMessageENS_14default_deleteIS7_EEEEEEclEOSA_ + 141
    11  FlutterMacOS                        0x000000010ec6420a _ZN7flutter20PlatformViewEmbedder21HandlePlatformMessageENSt3__110unique_ptrINS_15PlatformMessageENS1_14default_deleteIS3_EEEE + 74
    12  FlutterMacOS                        0x000000010e9beb84 _ZNSt3__110__function6__funcIN3fml8internal14CopyableLambdaIZN7flutter5Shell29OnEngineHandlePlatformMessageENS_10unique_ptrINS5_15PlatformMessageENS_14default_deleteIS8_EEEEE4$_16EENS_9allocatorISD_EEFvvEEclEv + 132
    13  FlutterMacOS                        0x000000010ec61522 _ZN7flutter18EmbedderTaskRunner8PostTaskEy + 738
    14  FlutterMacOS                        0x000000010ec4957c FlutterEngineRunTask + 44
    15  FlutterMacOS                        0x000000010e41c807 __60-[FlutterEngine postMainThreadTask:targetTimeInNanoseconds:]_block_invoke + 71
    16  libdispatch.dylib                   0x000000010bb29634 _dispatch_call_block_and_release + 12
    17  libdispatch.dylib                   0x000000010bb2a874 _dispatch_client_callout + 8
    18  libdispatch.dylib                   0x000000010bb3aea9 _dispatch_main_queue_callback_4CF + 1129
    19  CoreFoundation                      0x00007ff808ca13b8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    20  CoreFoundation                      0x00007ff808c629a6 __CFRunLoopRun + 2760
    21  CoreFoundation                      0x00007ff808c61809 CFRunLoopRunSpecific + 567
    22  HIToolbox                           0x00007ff811cce3e1 RunCurrentEventLoopInMode + 292
    23  HIToolbox                           0x00007ff811cce137 ReceiveNextEventCommon + 587
    24  HIToolbox                           0x00007ff811ccded5 _BlockUntilNextEventMatchingListInModeWithFilter + 70
    25  AppKit                              0x00007ff80b5b38f0 _DPSNextEvent + 886
    26  AppKit                              0x00007ff80b5b1f5c -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1411
    27  AppKit                              0x00007ff80b5a4359 -[NSApplication run] + 586
    28  AppKit                              0x00007ff80b5781f8 NSApplicationMain + 816
    29  new_flutter_project                 0x0000000102f016f9 main + 9
    30  dyld                                0x00000002030da4fe start + 462
    31  ???                                 0x0000000000000003 0x0 + 3

The warning is harmless, however, it indicates that messing around with the window's contentView is not recommended. Additionally, according to this post, it also affects the window's resize handle cursors, thus making the window harder to resize, which I can confirm.

The post I linked above also outlines a way to fix this issue, which is why I am opening this issue.