AravisProject / aravis

A vision library for genicam based cameras
GNU Lesser General Public License v2.1
840 stars 316 forks source link

Documentation request: documentation for each function should state how/whether to free the output #882

Closed dkogan closed 3 months ago

dkogan commented 3 months ago

Hi. I'm starting out, and it's not clear what should or should not be freed. In particular I was doing this:

    ArvGcNode* feature = get_string_or_enum_feature(key, device);
    ....
    g_object_unref(feature);

I wasn't getting any crashes, but things wouldn't work in mysterious ways. Apparently freeing the feature wasn't needed, and the unref was breaking stuff. It would be really good if the docs for each function were clear on this point.

Thank you very much for aravis!

EmmanuelP commented 3 months ago

Hi.

Do you have a precise example ?

arv_device_get_feature() seems correctly documented: https://aravisproject.github.io/aravis/aravis-stable/method.Device.get_feature.html

dkogan commented 3 months ago

Hi. I guess there're multiple kinds of similar-but-not identical documentation. I was looking at this:

https://aravisproject.github.io/docs/aravis-0.8/ArvDevice.html#arv-device-get-feature

It's missing the info about ownership. Those docs were linked from the main page. Should this be consolidated?

Thanks

EmmanuelP commented 3 months ago

I have removed the link to this obsolete documentation from the main page. I don't even know how it comes there is a content at this location.

EmmanuelP commented 3 months ago

By the way, the old documentation has the information (transfer none). This was made clearer with gi-docgen.

dkogan commented 3 months ago

Awesome; thanks. I just stumbled on two more documentation quirks. Fixing these should be easy, and would make it easier for new users:

dkogan commented 3 months ago

Oh, and if that snippet is indeed wrong, can the buffer be made const?