Skip to content

Invalidation token returned from Notification Center is not Send/Sync #817

@pronebird

Description

@pronebird
let handle = win.ns_window().unwrap() as *mut objc2_app_kit::NSWindow;
                let handle = objc2::rc::Retained::retain(handle).unwrap();

let nc = NSNotificationCenter::defaultCenter();
let invalidationToken = nc.addObserverForName_object_queue_usingBlock(
    Some(NSWindowDidBecomeKeyNotification),
    Some(handle.deref()),
    None,
    &RcBlock::new(|notification| {
        // Handle window becoming key
        tracing::info!("Window became key");
    }),
);

Basically it's impossible to store invalidationToken anywhere

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frameworkAffects the framework crates and the translator for them

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions