diff --git a/retroshare-qml-app/src/TokensManager.qml b/retroshare-qml-app/src/TokensManager.qml index 6a7bd498a..22a16614e 100644 --- a/retroshare-qml-app/src/TokensManager.qml +++ b/retroshare-qml-app/src/TokensManager.qml @@ -1,6 +1,6 @@ /* * RetroShare Android QML App - * Copyright (C) 2017 Gioacchino Mazzurco + * Copyright (C) 2017-2018 Gioacchino Mazzurco * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -30,7 +30,7 @@ QtObject { if(!maybeToken(token)) { - console.error("TokensManager attempt to register a non int token") + console.error("TokensManager attempt to register a non int token: ", token) console.trace() return } @@ -60,8 +60,41 @@ QtObject } else tokens[token] = [callback] } + function unRegisterToken(token, callback) + { + if(!maybeToken(token)) + { + console.error("TokensManager attempt to unregister a non int token: ", token) + console.trace() + return + } + + var remCount = 0; + var arrLen = tokens[token].length + for(var i=0; i + * Copyright (C) 2016-2018 Gioacchino Mazzurco * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -28,6 +28,7 @@ Item property int token: 0 Component.onCompleted: refreshData() + Component.onDestruction: TokensManager.unRegisterToken(token, refreshData) onVisibleChanged: visible && refreshData() function refreshDataCallback(par)