CommandPost / CommandPost

Workflow Enhancements for Creatives
https://commandpost.io
MIT License
426 stars 37 forks source link

Bug - Invalid order function for sorting #3018

Closed latenitefilms closed 2 years ago

latenitefilms commented 2 years ago
2022-07-07 16:51:59: 16:51:59 ERROR:   LuaSkin: hs.timer callback error: ...Post.app/Contents/Resources/extensions/cp/ui/axutils.lua:188: invalid order function for sorting
stack traceback:
    [C]: in function 'table.sort'
    ...Post.app/Contents/Resources/extensions/cp/ui/axutils.lua:188: in function 'cp.ui.axutils.children'
    ...urces/extensions/cp/apple/finalcutpro/viewer/InfoBar.lua:34: in field 'matches'
    ...ources/extensions/cp/apple/finalcutpro/viewer/Viewer.lua:115: in local 'fn'
    ...andPost.app/Contents/Resources/extensions/hs/fnutils.lua:108: in function 'hs.fnutils.ifilter'
    (...tail calls...)
    ...ources/extensions/cp/apple/finalcutpro/viewer/Viewer.lua:55: in upvalue 'findViewersUI'
    ...ources/extensions/cp/apple/finalcutpro/viewer/Viewer.lua:91: in function <...ources/extensions/cp/apple/finalcutpro/viewer/Viewer.lua:90>
    (...tail calls...)
    ...Post.app/Contents/Resources/extensions/cp/ui/axutils.lua:694: in function 'cp.ui.axutils.cache'
    (...tail calls...)
    ...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:509: in function <...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:506>
    (...tail calls...)
    ...es/extensions/cp/apple/finalcutpro/viewer/ControlBar.lua:77: in local 'finderFn'
    ...Post.app/Contents/Resources/extensions/cp/ui/axutils.lua:694: in function 'cp.ui.axutils.cache'
    (...tail calls...)
    ...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:993: in field '_get'
    ...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:509: in function <...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:506>
    (...tail calls...)
    ...es/extensions/cp/apple/finalcutpro/viewer/ControlBar.lua:107: in upvalue 'getFn'
    ...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:993: in field '_get'
    ...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:509: in function <...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:506>
    (...tail calls...)
    ...t.app/Contents/Resources/extensions/cp/ui/StaticText.lua:73: in upvalue 'getFn'
    ...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:993: in field '_get'
    ...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:509: in method 'get'
    ...dPost.app/Contents/Resources/extensions/cp/prop/init.lua:879: in method 'update'
    ...t.app/Contents/Resources/extensions/cp/ui/StaticText.lua:98: in function <...t.app/Contents/Resources/extensions/cp/ui/StaticText.lua:97>
latenitefilms commented 2 years ago

@randomeizer - This pops up in bug reports occasionally.

Maybe helpful: https://stackoverflow.com/questions/37092502/lua-table-sort-claims-invalid-order-function-for-sorting

It looks like this is the function that's causing the error:

function axutils.compare.leftToRight(a, b)
    local aFrame, bFrame = a:attributeValue("AXFrame"), b:attributeValue("AXFrame")
    return (aFrame ~= nil and bFrame ~= nil and aFrame.x < bFrame.x) or false
end

Maybe a or b is nil?

Should we change to something similar to the below?

function axutils.compare.leftToRight(a, b)
    local aFrame = a and a:attributeValue("AXFrame")
    local bFrame = b and b:attributeValue("AXFrame")
    return (type(aFrame) == "table" and type(bFrame) == "table" and aFrame.x < bFrame.x) or false
end
latenitefilms commented 2 years ago

Maybe related:

CommandPost v1.4.2 (Build: 7365)

Build Date:                     Jul  7 2022, 20:37:16
macOS Version:                  12.4.0
CommandPost Locale:             en_AU
Current Keyboard Layout:        U.S.
Final Cut Pro Path:             /Applications/Final Cut Pro.app
Final Cut Pro Version:          10.6.3
Final Cut Pro Language:         en
Developer Mode:                 true

2022-07-17 18:50:41: 2022-07-17 18:50:40: -- Loading /Users/chrishocking/Documents/GitHub/CommandPost/src/extensions/cp/init.lua
2022-07-17 18:50:41: 18:50:41         cp:     Loading Plugins...
2022-07-17 18:50:47: 18:50:47 ** Warning:   plugins: Slow Plugin: finalcutpro.setup.scan (3.956554889679)
2022-07-17 18:50:49: 18:50:49 ** Warning:   plugins: Slow Plugin: core.menu.menuaction (1.2737340927124)
2022-07-17 18:50:51: 18:50:51 ** Warning:   plugins: Slow Plugin (Post): core.loupedeckplugin.manager (2.25705909729)
2022-07-17 18:50:51:                  cp:     Plugins Loaded.
2022-07-17 18:50:51:                          Startup Time: 9.913633 seconds
2022-07-17 18:50:51:                          Garbage Collection Mode: generational
2022-07-17 18:50:51: -- Done.
2022-07-17 18:50:52: 18:50:52 ldPluginMa:     [Loupedeck Plugin] Latest plugin installed.
2022-07-17 18:54:20: 18:54:20 ERROR:      prop: Error while notifying a watcher: ...Documents/GitHub/CommandPost/src/extensions/cp/fn/ax.lua:463: attempt to index a nil value (local 'bFrame')
stack traceback:
    ...Documents/GitHub/CommandPost/src/extensions/cp/fn/ax.lua:463: in function 'cp.fn.ax.topToBottomBaseAligned'
    ...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:219: in function 'cp.fn.ax.topDown'
    [C]: in function 'table.sort'
    ...uments/GitHub/CommandPost/src/extensions/cp/fn/table.lua:353: in function <...uments/GitHub/CommandPost/src/extensions/cp/fn/table.lua:351>
    (...tail calls...)
    ...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:573: in function <...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:572>
    (...tail calls...)
    ...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:75: in function <...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:71>
    (...tail calls...)
    ...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:375: in upvalue 'predicate'
    ...uments/GitHub/CommandPost/src/extensions/cp/fn/table.lua:112: in function <...uments/GitHub/CommandPost/src/extensions/cp/fn/table.lua:110>
    (...tail calls...)
    ...Documents/GitHub/CommandPost/src/extensions/cp/fn/ax.lua:195: in upvalue 'getFn'
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:993: in field '_get'
    ... (skipping 7 levels)
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:811: in field 'fn'
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:1233: in function <...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:1233>
    [C]: in function 'xpcall'
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:1233: in upvalue '_notifyWatchers'
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:1277: in method '_notify'
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:880: in method 'update'
    ...g/Documents/GitHub/CommandPost/src/extensions/cp/app.lua:147: in upvalue 'fn'
    ...nts/GitHub/CommandPost/src/extensions/cp/ui/notifier.lua:424: in function <...nts/GitHub/CommandPost/src/extensions/cp/ui/notifier.lua:424>
    [C]: in function 'xpcall'
    ...nts/GitHub/CommandPost/src/extensions/cp/ui/notifier.lua:424: in upvalue 'v'
    ...nts/GitHub/CommandPost/src/extensions/cp/ui/notifier.lua:388: in function <...nts/GitHub/CommandPost/src/extensions/cp/ui/notifier.lua:387>
latenitefilms commented 2 years ago
CommandPost v1.4.3 (Build: 7369)

Build Date:                     Jul 23 2022, 07:16:34
macOS Version:                  12.4.0
CommandPost Locale:             en_AU
Current Keyboard Layout:        Australian
Final Cut Pro Path:             /Applications/Final Cut Pro.app
Final Cut Pro Version:          10.6.3
Final Cut Pro Language:         en
Developer Mode:                 true

2022-08-01 19:30:10: 2022-08-01 19:30:09: -- Loading /Users/chrishocking/Documents/GitHub/CommandPost/src/extensions/cp/init.lua
2022-08-01 19:30:10: 19:30:10         cp:     Loading Plugins...
2022-08-01 19:30:16: 19:30:16 ** Warning:   plugins: Slow Plugin: finalcutpro.setup.scan (3.8660678863525)
2022-08-01 19:30:18: 19:30:18 ** Warning:   plugins: Slow Plugin: core.menu.menuaction (1.2510569095612)
2022-08-01 19:30:20: 19:30:20 ** Warning:   plugins: Slow Plugin (Post): core.loupedeckplugin.manager (2.3091711997986)
2022-08-01 19:30:20:                  cp:     Plugins Loaded.
2022-08-01 19:30:20:                          Startup Time: 9.96027 seconds
2022-08-01 19:30:20:                          Garbage Collection Mode: generational
2022-08-01 19:30:20: -- Done.
2022-08-01 19:30:22: 19:30:22 ldPluginMa:     [Loupedeck Plugin] Latest plugin installed.
2022-08-01 19:32:16: 19:32:16 ERROR:      prop: Error while notifying a watcher: ...Documents/GitHub/CommandPost/src/extensions/cp/fn/ax.lua:463: attempt to index a nil value (local 'bFrame')
stack traceback:
    ...Documents/GitHub/CommandPost/src/extensions/cp/fn/ax.lua:463: in function 'cp.fn.ax.topToBottomBaseAligned'
    ...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:219: in function 'cp.fn.ax.topDown'
    [C]: in function 'table.sort'
    ...uments/GitHub/CommandPost/src/extensions/cp/fn/table.lua:353: in function <...uments/GitHub/CommandPost/src/extensions/cp/fn/table.lua:351>
    (...tail calls...)
    ...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:573: in function <...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:572>
    (...tail calls...)
    ...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:75: in function <...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:71>
    (...tail calls...)
    ...ng/Documents/GitHub/CommandPost/src/extensions/cp/fn.lua:375: in upvalue 'predicate'
    ...uments/GitHub/CommandPost/src/extensions/cp/fn/table.lua:112: in function <...uments/GitHub/CommandPost/src/extensions/cp/fn/table.lua:110>
    (...tail calls...)
    ...Documents/GitHub/CommandPost/src/extensions/cp/fn/ax.lua:195: in upvalue 'getFn'
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:993: in field '_get'
    ... (skipping 7 levels)
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:811: in field 'fn'
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:1233: in function <...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:1233>
    [C]: in function 'xpcall'
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:1233: in upvalue '_notifyWatchers'
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:1277: in method '_notify'
    ...ments/GitHub/CommandPost/src/extensions/cp/prop/init.lua:880: in method 'update'
    ...g/Documents/GitHub/CommandPost/src/extensions/cp/app.lua:147: in upvalue 'fn'
    ...nts/GitHub/CommandPost/src/extensions/cp/ui/notifier.lua:424: in function <...nts/GitHub/CommandPost/src/extensions/cp/ui/notifier.lua:424>
    [C]: in function 'xpcall'
    ...nts/GitHub/CommandPost/src/extensions/cp/ui/notifier.lua:424: in upvalue 'v'
    ...nts/GitHub/CommandPost/src/extensions/cp/ui/notifier.lua:388: in function <...nts/GitHub/CommandPost/src/extensions/cp/ui/notifier.lua:387>