Skip to content
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

expose lilv_free() with features, for windows compatibility #14

Closed
x42 opened this issue Dec 19, 2018 · 13 comments
Closed

expose lilv_free() with features, for windows compatibility #14

x42 opened this issue Dec 19, 2018 · 13 comments

Comments

@x42
Copy link
Contributor

x42 commented Dec 19, 2018

Various functions e.g. abstract_path() make the caller responsible for freeing the returned value with free().

On Windows this is not an option. Memory allocated by a library must be free()ed by that library/module

@x42 x42 closed this as completed Dec 19, 2018
@x42
Copy link
Contributor Author

x42 commented Dec 19, 2018

I was too quick.

A plugin does not link against liblilv and cannot call lilv_free() directly. A plugin receives abstract_path(), absolute_path() via the LV2_State_Map_Pathfeature. Is free()` needs to be part of the provided feature.

@x42 x42 reopened this Dec 19, 2018
@x42 x42 changed the title need lilv_free() for windows compatibility expose lilv_free() with features, for windows compatibility Dec 19, 2018
@drobilla
Copy link
Collaborator

drobilla commented Jun 5, 2019

@drobilla
Copy link
Collaborator

drobilla commented Dec 7, 2019

@x42 I've updated this on current master, and it seems fine as far as the (relatively limited) tests go. Did you have a specific motivating case it would be good to check before merging this stuff?

@x42
Copy link
Contributor Author

x42 commented Dec 7, 2019

All state restore methods that use map_path->abstract_path(). I've #idef'ed out the free() call in many plugins like

https://github.com/x42/convoLV2/blob/ff291a3d5e60ddbcf9458c3ad24d4a06c8252acb/lv2.c#L473-L475

@drobilla
Copy link
Collaborator

drobilla commented Dec 7, 2019

I don't have a setup at the moment that can build stuff outside lv2kit and friends on Windows. Let me rephrase: is there a specific motivating case you would like to check before this stuff gets merged? :)

@drobilla
Copy link
Collaborator

drobilla commented Dec 7, 2019

API-wise, as is so often the case, I really regret LV2 not having the ability to just jam stuff on the end of structs, getting a feature for this is pretty annoying, but... given reality, this seems fine to me.

x42 added a commit to x42/convoLV2 that referenced this issue Dec 7, 2019
@x42
Copy link
Contributor Author

x42 commented Dec 7, 2019

What is the envisaged way to test at compile-time if LV2_STATE__freePath is available?

@drobilla
Copy link
Collaborator

drobilla commented Dec 7, 2019

I didn't think about that. The LV2 version I guess?

@drobilla
Copy link
Collaborator

drobilla commented Dec 7, 2019

You could also just keep the fallback ifdeffed out as you did there I suppose.

@x42
Copy link
Contributor Author

x42 commented Dec 7, 2019

is the URI guarenteed to be a #define? if so

#ifdef LV2_STATE__freePath
...
#endif 

might work

@drobilla
Copy link
Collaborator

drobilla commented Dec 7, 2019

Same as anything else, really. I guess having an LV2_VERSION declared in the header would be handy, but it's annoying to have generated stuff in the headers, and that's what build systems are for...

Anyway, I guess I can stick this stuff on master and it can get hammered out a bit in practice in Ardour before release since IIRC you aren't using releases anyway.

@x42
Copy link
Contributor Author

x42 commented Dec 8, 2019

You could also just keep the fallback ifdeffed out as you did there I suppose.

I will do that for a while, at least until debian/stable picked up new LV2 headers.
Also #ifdef LV2_STATE__freePath looks like a reasonable test.

As far as I'm concerned, this issue can be closed. Thanks!

x42 added a commit to x42/midimap.lv2 that referenced this issue Dec 8, 2019
This fixes a memory-leak issue for Windows builds.
see also lv2/lilv#14
x42 added a commit to x42/zconvo.lv2 that referenced this issue Dec 8, 2019
This fixes a memory-leak issue for Windows builds.
see also lv2/lilv#14
x42 added a commit to x42/convoLV2 that referenced this issue Dec 8, 2019
This fixes a memory-leak issue for Windows builds.
see also lv2/lilv#14
@drobilla
Copy link
Collaborator

drobilla commented Dec 8, 2019

Addressed in ac562ca

@drobilla drobilla closed this as completed Dec 8, 2019
pauldavisthefirst pushed a commit to Ardour/ardour that referenced this issue Dec 8, 2019
This fixes a memory-leak issue for Windows builds.
see also lv2/lilv#14
swesterfeld added a commit to swesterfeld/spectmorph that referenced this issue Apr 20, 2023
This should fix problems on windows:

 - lv2/lilv#14

Signed-off-by: Stefan Westerfeld <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants