diff options
author | falkTX <falktx@falktx.com> | 2019-10-06 20:05:41 +0100 |
---|---|---|
committer | falkTX <falktx@falktx.com> | 2019-10-06 20:05:41 +0100 |
commit | 294d0ffd96091ca17eb6c5dcda312b1740796ebe (patch) | |
tree | 6104b0ee8add418c5ff5c8111cc28a1b03b8f93d | |
parent | 77ac455d49f85f64f475f7cf46e36fdf1a4e79cf (diff) | |
download | jack2-294d0ffd96091ca17eb6c5dcda312b1740796ebe.tar.gz |
Only trigger property callback on close if there is 1 or more
Also document this usecase
Signed-off-by: falkTX <falktx@falktx.com>
-rw-r--r-- | common/JackEngine.cpp | 19 | ||||
-rw-r--r-- | common/jack/metadata.h | 12 |
2 files changed, 24 insertions, 7 deletions
diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index e3bf7992..7d721ebd 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -773,11 +773,12 @@ int JackEngine::ClientCloseAux(int refnum, bool wait) } } - fMetadata.RemoveProperties(NULL, uuid); - /* have to do the notification ourselves, since the client argument - to fMetadata->RemoveProperties() was NULL - */ - PropertyChangeNotify(uuid, NULL, PropertyDeleted); + if (fMetadata.RemoveProperties(NULL, uuid) > 0) { + /* have to do the notification ourselves, since the client argument + to fMetadata->RemoveProperties() was NULL + */ + PropertyChangeNotify(uuid, NULL, PropertyDeleted); + } // Notify running clients NotifyRemoveClient(client->GetClientControl()->fName, refnum); @@ -912,8 +913,12 @@ int JackEngine::PortUnRegister(int refnum, jack_port_id_t port_index) const jack_uuid_t uuid = jack_port_uuid_generate(port_index); if (!jack_uuid_empty(uuid)) { - fMetadata.RemoveProperties(NULL, uuid); - PropertyChangeNotify(uuid, NULL, PropertyDeleted); + if (fMetadata.RemoveProperties(NULL, uuid) > 0) { + /* have to do the notification ourselves, since the client argument + to fMetadata->RemoveProperties() was NULL + */ + PropertyChangeNotify(uuid, NULL, PropertyDeleted); + } } if (client->GetClientControl()->fActive) { diff --git a/common/jack/metadata.h b/common/jack/metadata.h index 80c7e99a..9e026161 100644 --- a/common/jack/metadata.h +++ b/common/jack/metadata.h @@ -194,6 +194,18 @@ typedef enum { PropertyDeleted } jack_property_change_t; +/** + * Prototype for the client supplied function that is called by the + * engine anytime a property or properties have been modified. + * + * Note that when the key is empty, it means all properties have been + * modified. This is often used to indicate that the removal of all keys. + * + * @param subject The subject the change relates to, this can be either a client or port + * @param key The key of the modified property (URI string) + * @param change Wherever the key has been created, changed or deleted + * @param arg pointer to a client supplied structure + */ typedef void (*JackPropertyChangeCallback)(jack_uuid_t subject, const char* key, jack_property_change_t change, |