mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Qml app allow registrer same callback
As I haven't investigated this enough yet, allow it happening but warn if it happens while debugging
This commit is contained in:
parent
943a4213fb
commit
871ea333fc
@ -30,16 +30,23 @@ QtObject
|
||||
{
|
||||
if (Array.isArray(tokens[token]))
|
||||
{
|
||||
// Do not register if it is registered already
|
||||
if(QT_DEBUG)
|
||||
{
|
||||
/* Haven't properly investigated yet if it may happen in normal
|
||||
* situations that a callback is registered more then once, so
|
||||
* if we are in a debug session and that happens print warning
|
||||
* and stacktrace */
|
||||
var arrLen = tokens[token].length
|
||||
for(var i=0; i<arrLen; ++i)
|
||||
{
|
||||
if(callback === tokens[token][i])
|
||||
{
|
||||
console.warn("tokensManager.registerToken(token, callback)",
|
||||
"Attempt to register same callback twice for:",
|
||||
console.warn("tokensManager.registerToken(token," +
|
||||
" callback) Attempt to register same" +
|
||||
" callback twice for:",
|
||||
i, token, callback)
|
||||
return
|
||||
console.trace()
|
||||
}
|
||||
}
|
||||
}
|
||||
tokens[token].push(callback)
|
||||
|
Loading…
Reference in New Issue
Block a user