Skip to content

Error in destructor #7

@ChristianStadelmann

Description

@ChristianStadelmann

In my code, I create a processManager object. When it goes out of scope, i.e., when Matlab decides to call the destructor, I sporadically¹ see this error message:

The following error was caught while executing 'processManager' class destructor:
Error using timer/stop (line 34)
Invalid timer object. This object has been deleted and should be removed from your workspace using CLEAR.

Error in processManager/delete (line 483)
               stop(self.pollTimer);

I guess that this is a race condition between the destructor and the timer's stop() function calling pollTimerStop().

Would it help to turn pollTimerStop() into a non-static function which not only deletes the timer at the end, but also sets this.pollTimer = [];?


¹ sporadically in this context means something like once in 100 executions.

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