Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

segmentation fault reading attribute (or accessing DevProxy in general) during application shutdown #540

@delleceste

Description

@delleceste

Hello.
This sample code represents a Qt class which is created at application startup and then destroyed when the application exists.

CuCustomWidgetCollectionInterface::CuCustomWidgetCollectionInterface(QObject *parent): QObject(parent)
{
    dev = new Tango::DeviceProxy("test/device/4");
    try {
        Tango::DeviceAttribute da;
        da = dev->read_attribute("double_spectrum_ro");
        std::vector<double> vd;
        da >> vd;
    }
    catch(Tango::DevFailed &e) {

    }
}

CuCustomWidgetCollectionInterface::~CuCustomWidgetCollectionInterface()
{
    printf("\e[1;31mo\e[0m ~CuCustomWidgetCollectionInterface %p\n", this);
    try {
        Tango::DeviceAttribute da;
        da = dev->read_attribute("double_spectrum_ro");  // SEGFAULT
        std::vector<double> vd;
        da >> vd;
    }
    catch(Tango::DevFailed &e) {
    }
}

This class is destroyed by Qt at the very end of the application life cycle. It is managed by Qt plugin system, so it is created and free by Qt.
In practise, I would like to accurately free Tango DeviceProxies when the Qt designer releases its resources at close time.

In normal Qt applications, when it's me who decides the proper point when to destroy Tango DeviceProxy references, I do not face the issue.

I guess there is a moment in an application life after which it becomes unsafe to access a DeviceProxy previously instantiated and used.

Can you confirm this?
What is this moment? (I remind from former releases something called the shutdown of the ORB)
Is it possible to fix it?

Thanks in advance.

Giacomo. ELETTRA

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions