fix deallocated clipboard/emoji views #728
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When keyboard instance is destroyed (such as by switching to another keyboard), postDeallocateMemory() is issued by the handler of LatinIME, and the clipboard and emoji views memory is deallocated after 10 seconds (the delay of the message) even if the keyboard instance is recreated in the meantime.
cancelDeallocateMemory() does not seem to remove the pending message for some reason.
That causes all emojis/clipboard entries to suddenly vanish.
Here is a video taken from #616 showing how to reproduce the bug (credit to @Uranusek)
318530574-e4556051-3029-40b4-a479-ff27fc7df453.mp4
With the small check I altered, the memory of those views will not be deallocated any longer when they are visible