Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
e05f3311
Commit
e05f3311
authored
Dec 06, 2016
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix MethodCall observer not to be gabage collected.
parent
eccd1b9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
MethodCall.java
...n/java/chat/rocket/android/model/internal/MethodCall.java
+6
-0
No files found.
app/src/main/java/chat/rocket/android/model/internal/MethodCall.java
View file @
e05f3311
...
...
@@ -12,6 +12,7 @@ import chat.rocket.android.realm_helper.RealmObjectObserver;
import
chat.rocket.android.service.RocketChatService
;
import
io.realm.RealmObject
;
import
io.realm.annotations.PrimaryKey
;
import
java.util.HashMap
;
import
java.util.UUID
;
import
org.json.JSONObject
;
import
timber.log.Timber
;
...
...
@@ -89,6 +90,8 @@ public class MethodCall extends RealmObject {
}
}
private
static
final
HashMap
<
String
,
RealmObjectObserver
<
MethodCall
>>
refMap
=
new
HashMap
<>();
/**
* insert a new record to request a method call.
*/
...
...
@@ -122,14 +125,17 @@ public class MethodCall extends RealmObject {
task
.
setResult
(
resultJson
);
}
observer
.
unsub
();
refMap
.
remove
(
methodCall
.
getMethodCallId
());
remove
(
realmHelper
,
methodCall
.
getMethodCallId
()).
continueWith
(
new
LogcatIfError
());
}
else
if
(
syncstate
==
SyncState
.
FAILED
)
{
task
.
setError
(
new
Error
(
methodCall
.
getResultJson
()));
observer
.
unsub
();
refMap
.
remove
(
methodCall
.
getMethodCallId
());
remove
(
realmHelper
,
methodCall
.
getMethodCallId
()).
continueWith
(
new
LogcatIfError
());
}
});
observer
.
sub
();
refMap
.
put
(
newId
,
observer
);
if
(
context
!=
null
)
{
RocketChatService
.
keepalive
(
context
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment