Skip to content

Reference-counting pointers #2

@eudoxos

Description

@eudoxos

I am opening this issue to discuss how to use pointers in the Python scripter. The problem I see is that scribus uses raw pointers internally, so the wrapper has to use those as well (of course this involves risky things, such as objects being deleted while the scriper is active). There is no way to use managed pointers (shared_ptr and similar, also including unique_ptr) when some parts of the code don't use them.

So the way is either to start using shared_ptr inside scribus (that would be my idea, but it is a huge change for the whole code), they integrate beautifully with python reference counting. This is high-performance computing code https://woodem.org/ using shared_ptr and is entirely scriptable in python. The advantage is that Python can go as deep into the internal structures as desired.

Another options is that the scripter will use raw pointers (perhaps wrapped in lightweight wrapperss) and assume that the underlying document will never change while the script is running, so that none of the pointers becomes stale, leading to Python crashing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions