Ottodix / Eole-foobar-theme

Eole blows gently into your ear his nicest melodies.
1.29k stars 85 forks source link

too many arguments provided for a function call #292

Closed zananashi closed 1 month ago

zananashi commented 3 months ago

I get this error when I press on "All" in my Library Tree. Might be because I have a massive lib, but not sure.

Error: Spider Monkey Panel v1.6.1 (LibraryTree: LibraryTree v1.2.3b22 by Ottodix) too many arguments provided for a function call

File: WSHlibrary_tree.js Line: 2869, Column: 37 Stack trace: populate/this.get_selection@WSHlibrary_tree.js:2869:37 populate/this.lclick_action@WSHlibrary_tree.js:2765:41 populate/this.lbtn_dn@WSHlibrary_tree.js:2794:10 on_mouse_lbtn_down@WSHlibrary_tree.js:4780:7

JadeTank commented 3 months ago

How big exactly is your library? I wasn't able to replicate this directly, but javascript has a limit to how many arguments can be passed, dependent on the memory available. By adding this code to the WSHlibrary_tree.js file mine threw a similar error at about 3.5 billion

function testArgs() {
    console.log(arguments.length);
}

var argLen = 0;
for (var i = 1; i < 32; i++) {
    argLen = (argLen << 1) + 1;
    testArgs.apply(null, new Array(argLen));
}
zananashi commented 3 months ago

How big exactly is your library? I wasn't able to replicate this directly, but javascript has a limit to how many arguments can be passed, dependent on the memory available. By adding this code to the WSHlibrary_tree.js file mine threw a similar error at about 3.5 billion

function testArgs() {
    console.log(arguments.length);
}

var argLen = 0;
for (var i = 1; i < 32; i++) {
    argLen = (argLen << 1) + 1;
    testArgs.apply(null, new Array(argLen));
}

My library is about 11.5TB right now, a mix of flac, mp3 and wav

JadeTank commented 3 months ago

Yeah that could probably do it, it's just passing too many items for js. Will try to see if I can fix it, but it may require a more in depth rewrite than I can handle.

zananashi commented 3 months ago

Yeah that could probably do it, it's just passing too many items for js. Will try to see if I can fix it, but it may require a more in depth rewrite than I can handle.

Thank you for taking a look into it, I realize its a very niche problem.

JadeTank commented 2 months ago

Would you be able to try editing the WSHlibrary_tree.js file and adding this? Replace line 2869 this.sel_items.push.apply(this.sel_items, this.tree[idx].item); With this this.sel_items = this.sel_items.concat(this.tree[idx].item); And seeing if it fixes the issue? I'm hoping it should be appending the array in such a way that too many arguments aren't being passed. It appears to work for me, but I can't confirm it solves the issue since I don't have enough items in my library to cause it.

zananashi commented 2 months ago

How could I do that? Sorry if the question is stupid

2024年4月4日(木) 16:54 JadeTank @.***>:

Would you be able to try editing the WSHlibrary_tree.js file and adding this? Replace line 2869 this.sel_items.push.apply(this.sel_items, this.tree[idx].item); With this this.sel_items = this.sel_items.concat(this.tree[idx].item); And seeing if it fixes the issue? I'm hoping it should be appending the array in such a way that too many arguments aren't being passed. It appears to work for me, but I can't confirm it solves the issue since I don't have enough items in my library to cause it.

— Reply to this email directly, view it on GitHub https://github.com/Ottodix/Eole-foobar-theme/issues/292#issuecomment-2037434947, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDTOQV4R3RYJDVS3UYLJGZ3Y3VSS5AVCNFSM6AAAAABEVZWUHKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZXGQZTIOJUG4 . You are receiving this because you authored the thread.Message ID: @.***>

JadeTank commented 2 months ago

In your foobar directory, go to "profile\themes\eole\js\WSHlibrary_tree.js" and open it with a text editor of some kind. Navigate to line 2869, and replace the previous code with the new from the previous reply.

zananashi commented 2 months ago

Thank you, I think that fixed it. No errors for now and everything seems to work

JadeTank commented 2 months ago

Great! I have the change made on my own install as well, but please let me know if you encounter any issues related to it. If not, I will upload the change to the repo at some point in the near future.

zananashi commented 2 months ago

Will do!

2024年4月4日(木) 22:45 JadeTank @.***>:

Great! I have the change made on my own install as well, but please let me know if you encounter any issues related to it. If not, I will upload the change to the repo at some point in the near future.

— Reply to this email directly, view it on GitHub https://github.com/Ottodix/Eole-foobar-theme/issues/292#issuecomment-2038183952, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDTOQVZKXFVSS7PWPKUGW2LY3W3X7AVCNFSM6AAAAABEVZWUHKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZYGE4DGOJVGI . You are receiving this because you authored the thread.Message ID: @.***>

zananashi commented 2 months ago

Getting this error now when I right click in the middle where all the albums are listed

Error: Spider Monkey Panel v1.6.1 (GraphicBrowser: GraphicBrowser v1.2.3b22 by Ottodix) AppendMenuItem failed: WinAPI error: AppendMenu failed with error (0x0): Function failed, but returned a SUCCESS error code, which is usually caused by a bugged WinAPI. One such case is when process runs out of GDI handles and can't create a new GDI object.

File: JStheme_common.js Line: 1919, Column: 58 Stack trace: createGenrePopupMenu@JStheme_common.js:1919:58 on_mouse_rbtn_down@WSHgraphicbrowser_trackinfos.js:6487:25

JadeTank commented 2 months ago

Does the error happen if you change the code back, or is it a separate issue?

zananashi commented 2 months ago

Yeah sorry, seems like its not related to this issue, just a different bug

2024年4月24日(水) 17:36 JadeTank @.***>:

Does the error happen if you change the code back, or is it a separate issue?

— Reply to this email directly, view it on GitHub https://github.com/Ottodix/Eole-foobar-theme/issues/292#issuecomment-2075237671, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDTOQV7DCDUT5WPZRCMIZ5TY67GRPAVCNFSM6AAAAABEVZWUHKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZVGIZTONRXGE . You are receiving this because you authored the thread.Message ID: @.***>

JadeTank commented 1 month ago

Have been busy recently, gonna try to work on this a bit again soon. I moved the issue you are having to a new issue here #298

I will be closing this one as it appears to have been resolved, feel free to reopen it if not.