How to handle listener lifetime in MATLAB apps?
Mostra commenti meno recenti
This simple two-window app has a data source app which passes data via an event to one or more listeners. The source is waveformMaker_01.mlapp and receiver(s) xyPlotter_01.mlapp.
Q1) I am principally concerned with the lifetime of the event.listeners.
At present I store these in the receiver and delete them with the receiver's <mainUIFigure>CloseRequest() callback. But the ...CloseRequest() callback is not called when the receiver is simply delete()-ed, which leaves the event.listeners extant but invalid. For now I can call close( <receiver>.<mainUIFigure>) but the principle that destructors must properly close resources when objects go out of scope is broken.
Is there a better way to control the lifetime of the event.listeners?
Q2) There is a choice to either send data in a custom EventData class or to poll the source for the next chunk of data. Which method is preferred? (I recognise that my AnyEventData class is a kludge.)
Q3) Any other code review comments?
Risposte (1)
RST
il 5 Dic 2023
Categorie
Scopri di più su Develop Apps Using App Designer in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!