From 65578f06fe53178e5c7b948d5b2a600f179cce6e Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Thu, 13 Oct 2022 17:25:20 -0400 Subject: [PATCH] Swap WebView class registration to use class fn --- src/webview/class.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/webview/class.rs b/src/webview/class.rs index 507ebf4..aedc5d4 100644 --- a/src/webview/class.rs +++ b/src/webview/class.rs @@ -170,16 +170,7 @@ extern "C" fn handle_download(this: &Object, _: Sel, downloa /// both a subclass of `NSViewController` and a delegate of the held `WKWebView` (for the various /// varieties of delegates needed there). pub fn register_webview_class() -> *const Class { - static mut VIEW_CLASS: *const Class = 0 as *const Class; - static INIT: Once = Once::new(); - - INIT.call_once(|| unsafe { - let superclass = class!(WKWebView); - let decl = ClassDecl::new("RSTWebView", superclass).unwrap(); - VIEW_CLASS = decl.register(); - }); - - unsafe { VIEW_CLASS } + load_or_register_class("WKWebView", "CacaoWebView", |decl| unsafe {}) } /// Registers an `NSViewController` that we effectively turn into a `WebViewController`. Acts as