-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preserve signal pointers #63
Conversation
obviously, i'll need to put back the compile-time checks for |
6feee9f
to
3b63c2f
Compare
done. tested with pd0.53-2. |
This doesn't work for me. The basic multichannel.pd example (included in pdlua/examples/multichannel) now fails with this error message:
I compiled against vanilla 0.55.1, but I get the same error when compiling and running with purr-data. Now there might be something wrong with the example, but it's a very simple example and worked without a hitch before. |
i'll check. thanks for the feedback! |
3b63c2f
to
73ac4e4
Compare
should be fixed. x->sp assignment in dsp was missing after i removed it in a previous attempt - things got botched a bit here. hope it's ok now - but i'll check once more tomorrow. |
Ok, thx, looks good to me now. Maybe @timothyschoen can have a look at well. Tim? |
i'm unsure about the probably, it doesn't make sense to free the current size in the dsp function - this should be the previous size, right? i'd change this then if that sounds right. |
Yes, so you also need to keep track of the allocated size somewhere. AFAICT, that's for Pd's own internal tracking of allocated memory if it was compiled with Or use calloc/free instead. That's what Pd itself uses internally, but it won't allow Pd to track the memory usage. |
done with 67f679f |
67f679f
to
69783ff
Compare
69783ff
to
e691179
Compare
Works for me. Not sure what to test with the example in #63, though. Did you check that the clone stuff still works? |
yep. it does behave as expected now for me. what i'm doing in this demo here crashed pd with the previous version if only the second subpatch was connected: 2024-10-18.11-28-07.mp4 |
Hold the horses. In purr-data, the test-crashd.pd from #63 actually crashes when closing the patch:
This doesn't happen in vanilla, so I suspect that there's some difference between purr-data's clone and vanilla's. But I don't know how to debug this. :( |
The patch in your video looks different from the one you posted in #63. Can you please provide it? Does it use any 3rd party external? |
i think i might have freed that sig_info array in the wrong context (pdlua_free instead of pdlua_object_free). changed with 5027f71 will attach this new test in a minute. hold on ... |
this should include the 3 required files (test patch, clone patch and lua object): |
Well, test-crashd.pd also crashes in purr-data without your changes, so there's probably something wrong in purr-data's clone. But your most recent change, moving the deallocation to pdlua_object_free, looks reasonable anyway. |
Thanks for the updated test and the video, that clarifies things. However, try as I might, I can't reproduce the crash that you described with Pd 0.55-1 running stock pd-lua 0.12.22. Do you have a screencast of Pd actually crashing without the changes in this PR? |
Your new example also seems to work fine for me in purr-data with pd-lua 0.12.22. (Apart from crashing purr-data when I close the patch, which is obviously a separate issue in purr-data's clone; I'll look into this asap.) |
there you go: 2024-10-18.12-15-05.mp4... it's well possible that my fixes here aren't complete btw. the root problem causing this PR was that (seemingly) when i forwarded just the maybe, the current solution is also not good and i should go back to |
@agraef : i don't think it'll make a difference in your tests - but anyway: could you give the version in https://github.com/ben-wes/pd-lua/tree/fix/stablesignals_simple a try? |
Thanks, I can reproduce the crash now.
That branch is broken for me, in both vanilla and purr-data. Specifically, the osci3d~ example suddenly doesn't work any more. Instead, it spits out this strange error message as soon as you turn on dsp:
The fix/stablesignals branch doesn't do that. But admittedly I didn't really test that branch very thoroughly either so far. So I think that your PR needs a lot more scrutiny than I can muster right now. I'm away over the weekend, so I'll keep this PR open until I return. I'd recommend that you really put the PR through its paces during this time, testing all existing functionality, including older single-channel, and even non-signal pd-lua code, pdx live-coding etc., anything you can think of. It doesn't matter whether breakage results from the basic multi-channel support or this PR, our aim should be to really get it right this time, ok? |
Code looks good to me, except I think that we're leaking sig_info when the object is deleted. But other than that, I think this good! I'll test this in plugdata now. |
It works inside plugdata too. I've tested with AddressSanitizer enabled, no issues :) |
I don't think we do, have a look at pdlua.c:1934. |
I also found and fixed the purr-data clone issue (which, as I suspected, was unrelated). Will do some more testing of this PR with the other examples tonight if I find the time. Ben, what's your take, is this ready to be merged? Or would you prefer to have another go at the simplified version? |
Good to know. Thanks for testing! |
oh! glad to see how things are moving here and thanks to both of you! ... i made one more force push on the other branch which is just this commit ahead of the one we're discussing here: cbe4d87 ... i would prefer that other version for simplicity since that |
ah ... i didn't test everything yet probably - but i made builds with and without mc (against pd0.53-2 and 0.55-1) and tested with these versions as well. all 4 vanilla tests worked for me here. |
sorry, I didn't make that clear enough. I reproduced that issue and the force-pushed version includes a fix for this. at least here, osci3d worked then. |
Yes, this looks good now. I gave it a whirl with a number of different patches, as well as the test-crash-gui example (which thankfully doesn't crash anymore 😉), in both vanilla and purr-data, and didn't encounter any further issues. If you pull over rev. cbe4d87, then I will merge, tag a new release, and call it a day. |
Never mind, I just went ahead and merged this PR, then the other branch. Thanks! |
saw this a little too late on the phone here. anyway: thanks a lot! hope, this code will live a little longer than the previous one. :) |
closes #62
... not sure if this is the best way to solve the issue - but it was obviously not a good idea to forward the whole
t_signal
struct pointer to the perform function since those pointers seem to possibly get overwritten there.this PR adds a newsig_info
struct to the object struct which holds the vector pointer and channel count of the signals.keeping this as a draft for now. it fixes the issue for me - but it might not be a good solution?