Skip to content

Commit

Permalink
Remove warnings from canvas and toolbar (#3475)
Browse files Browse the repository at this point in the history
* remove canvas warning about delete

* remove toolbar warning about missing identifier
  • Loading branch information
asmagill authored Dec 10, 2023
1 parent 027142a commit e36bceb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions extensions/canvas/libcanvas.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
static LSRefTable refTable = LUA_NOREF;
static BOOL defaultCustomSubRole = YES ;

static int warnedAboutDelete = 0 ;
// static int warnedAboutDelete = 0 ;

// Can't have "static" or "constant" dynamic NSObjects like NSArray, so define in lua_open
static NSDictionary *languageDictionary ;
Expand Down Expand Up @@ -3187,10 +3187,10 @@ static int canvas_delete(lua_State *L) {

// HSCanvasView *canvasView = [skin luaObjectAtIndex:1 toClass:"HSCanvasView"] ;
// HSCanvasWindow *canvasWindow = canvasView.wrapperWindow ;
if (warnedAboutDelete < 10) {
warnedAboutDelete++ ;
[skin logWarn:[NSString stringWithFormat:@"%s:delete - explicit delete is no longer required for canvas objects; garbage collection occurs automatically", USERDATA_TAG]] ;
}
// if (warnedAboutDelete < 10) {
// warnedAboutDelete++ ;
// [skin logWarn:[NSString stringWithFormat:@"%s:delete - explicit delete is no longer required for canvas objects; garbage collection occurs automatically", USERDATA_TAG]] ;
// }
canvas_hide(L) ;
lua_pop(L, 1) ; // remove userdata pushed by hide

Expand Down
16 changes: 8 additions & 8 deletions extensions/webview/libwebview_toolbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ - (instancetype)initWithIdentifier:(NSString *)identifier itemTableIndex:(int)id
_itemDefDictionary = [[NSMutableDictionary alloc] init] ;
_fnRefDictionary = [[NSMutableDictionary alloc] init] ;
_enabledDictionary = [[NSMutableDictionary alloc] init] ;

if (@available(macOS 11.0, *)) {
_toolbarStyle = NSWindowToolbarStyleAutomatic ;
}
Expand Down Expand Up @@ -148,7 +148,7 @@ - (instancetype)initWithCopy:(HSToolbar *)original andState:(lua_State *)L{
if (@available(macOS 11.0, *)) {
_toolbarStyle = original.toolbarStyle ;
}

self.allowsUserCustomization = original.allowsUserCustomization ;
self.allowsExtensionItems = original.allowsExtensionItems ;
self.autosavesConfiguration = original.autosavesConfiguration ;
Expand Down Expand Up @@ -695,9 +695,9 @@ - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString
}
toolbarItem.enabled = flag ? [self validateToolbarItem:toolbarItem] : YES ;
[self fillinNewToolbarItem:toolbarItem] ;
} else {
// may happen on a reload if toolbar autosave contains id's that were added after the toolbar was created but haven't been created yet since the reload
[LuaSkin logInfo:[NSString stringWithFormat:@"%s:toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: invoked with nonexistent identifier:%@", USERDATA_TB_TAG, identifier]] ;
// } else {
// // may happen on a reload if toolbar autosave contains id's that were added after the toolbar was created but haven't been created yet since the reload
// [LuaSkin logInfo:[NSString stringWithFormat:@"%s:toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: invoked with nonexistent identifier:%@", USERDATA_TB_TAG, identifier]] ;
}
return toolbarItem ;
}
Expand Down Expand Up @@ -962,12 +962,12 @@ static int attachToolbar(lua_State *L) {
theWindow.toolbar = newToolbar ;
newToolbar.windowUsingToolbar = theWindow ;
newToolbar.visible = YES ;

// Update the toolbar style if available:
if (@available(macOS 11.0, *)) {
theWindow.toolbarStyle = newToolbar.toolbarStyle;
}

}
lua_pushvalue(L, 1) ;
} else {
Expand Down Expand Up @@ -1351,7 +1351,7 @@ static int toolbarStyle(lua_State *L) {
LuaSkin *skin = [LuaSkin sharedWithState:L] ;
[skin checkArgs:LS_TUSERDATA, USERDATA_TB_TAG, LS_TSTRING | LS_TOPTIONAL, LS_TBREAK] ;
HSToolbar *toolbar = [skin toNSObjectAtIndex:1] ;

if (lua_gettop(L) == 2) {
if (@available(macOS 11.0, *))
{
Expand Down

0 comments on commit e36bceb

Please sign in to comment.