Closed DDavidPrime closed 4 years ago
hello @DDavidPrime, can you, please, describe how we can reproduce your issue. Please add logs from the flutter console with error for a better understanding of your issue.
Same error here. We need to close session and then log in with another user, but calling CubeChatConnection.instance.destroy() it crashes:
The method 'closeStreams' was called on null. Receiver: null Tried calling: closeStreams()
@TatankaConCube Updated the original issue and added logs (even though I don't think they will be much of help). If anything else I can help with, please let me know.
we are investigating this issue, thank you for your help
@DDavidPrime today we released version 0.4.1 with required fixes. Please check and close this ticket if your issue resolved.
The issue is fixed. Closing this now...
Hi there.
I was using your package and noticed that when using the chat some of the managers inside
CubeChatConnection.instance
get initialized while you use them and others don't (they keep thenull
value). This may not be a problem, but the issue arises when you use theCubeChatConnection.instance.destroy()
method. In this case, the_closeManager(manager);
will fail at the first null value and throw an error, preventing the other managers to be closed afterwards.My suggestion is to do a null check before closing the manager as this will fix the problem.
Edit: After debugging I noticed that after calling
_closeManager();
inside thedestroy()
method, even though the manager was closed, it's reference is still not set to null.Steps to reproduce:
Additional Info: While debugging, I placed a breakpoint on
CubeChatConnection.instance.destroy()
in the previous code. Stepping into that method and examining line by line, I eventually got to the line_closeManager(_privateChatManager);
which threw an exception, because_privateChatManager
wasnull
. Because of that, the execution of the method didn't continue, so other manager didn't get closed. Additionally, in another scenario, where_privateChatManager
was not null,_closeManager
method did close it, but it's value wasn't set to null afterwards.Logs:
Click to expand/collapse
I don't think there are any errors logged, but here's the log anyway:
``` I/flutter (21949): login with usr1 and 12345678 I/flutter (21949): CB-SDK: : ========================================================= I/flutter (21949): === REQUEST ==== 1b4e7bb3-3095-458e-8ef2-f21ccfc201f0 === I/flutter (21949): REQUEST I/flutter (21949): POST https://api.connectycube.com/session I/flutter (21949): HEADERS I/flutter (21949): {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 0.4.0, CB-Token: } I/flutter (21949): BODY I/flutter (21949): {"application_id":"476","auth_key":"PDZjPBzAO8WPfCp","nonce":"1795023071","timestamp":"1599472578","signature":"a3a87d5e24c42732b42b80fa334b18b358d1f324","user":{"login":"usr1","password":"12345678"}} I/flutter (21949): I/flutter (21949): CB-SDK: : ********************************************************* I/flutter (21949): *** RESPONSE *** 201 *** 1b4e7bb3-3095-458e-8ef2-f21ccfc201f0 *** I/flutter (21949): HEADERS I/flutter (21949): {connection: keep-alive, cache-control: max-age=0, private, must-revalidate, set-cookie: _mkra_ctxt=4a0c83452f59cfa275ba9dc2fa65a123--201; path=/; max-age=5; HttpOnly; secure, status: 201 Created, transfer-encoding: chunked, date: Mon, 07 Sep 2020 09:56:21 GMT, access-control-allow-origin: *, strict-transport-security: max-age=31536000,max-age=15768000;, content-type: application/json; charset=utf-8, x-xss-protection: 1; mode=block, server: nginx/1.16.1, x-request-id: 92a7b48f-ad11-4bfa-a7ba-cb1c00277351, cb-token-expirationdate: 2020-09-07 11:56:21 UTC, connectycube-rest-api-version: 0.1.1, x-runtime: 0.038022, etag: W/"6796b6f55063f3520a54dcbf0261d934", x-frame-options: SAMEORIGIN, x-content-type-options: nosniff} I/flutter (21949): BODY I/flutter (21949): {"session":{"id":16826016,"user_id":1890491,"application_id":476,"nonce":1795023071,"token":"315b34b90e8b290ac653bc276a3741406e0001dc","ts":1599472578,"created_at":"2020-09-07T09:56:21Z","updated_at":"2020-09-07T09:56:21Z","user":{"id":1890491,"full_name":"usr1","email":null,"login":"usr1","phone":null,"website":null,"created_at":"2020-09-07T09:17:12Z","updated_at":"2020-09-07T09:56:21Z","last_request_at":"2020-09-07T09:56:21Z","external_user_id":null,"facebook_id":null,"twitter_id":null,"blob_id":null,"custom_data":null,"avatar":null,"user_tags":null}}} I/flutter (21949): I/flutter (21949): _loginToCubeChat user {full_name: usr1, email: null, login: usr1, phone: null, website: null, last_request_at: 2020-09-07 09:56:21.000Z, external_user_id: null, facebook_id: null, twitter_id: null, password: 12345678, oldPassword: null, custom_data: null, avatar: null, tag_list: null, id: 1890491, created_at: 2020-09-07 09:17:12.000Z, updated_at: 2020-09-07 09:56:21.000Z} I/flutter (21949): sending: I/flutter (21949):