mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-17 00:07:49 +00:00
Fix chat view memory leak (#829)
This commit is contained in:
parent
5c36b00d07
commit
317aa2e72f
1 changed files with 8 additions and 4 deletions
|
@ -407,7 +407,7 @@ public class ChatView extends AnchorPane {
|
|||
attachmentsBox.getChildren().clear();
|
||||
if (allowAttachments &&
|
||||
message.getAttachments() != null &&
|
||||
message.getAttachments().size() > 0) {
|
||||
!message.getAttachments().isEmpty()) {
|
||||
AnchorPane.setBottomAnchor(messageLabel, bottomBorder + attachmentsBoxHeight + 10);
|
||||
attachmentsBox.getChildren().add(new AutoTooltipLabel(Res.get("support.attachments") + " ") {{
|
||||
setPadding(new Insets(0, 0, 3, 0));
|
||||
|
@ -662,8 +662,12 @@ public class ChatView extends AnchorPane {
|
|||
}
|
||||
|
||||
public void scrollToBottom() {
|
||||
if (messageListView != null)
|
||||
UserThread.execute(() -> messageListView.scrollTo(Integer.MAX_VALUE));
|
||||
UserThread.execute(() -> {
|
||||
if (messageListView != null && !messageListView.getItems().isEmpty()) {
|
||||
int lastIndex = messageListView.getItems().size();
|
||||
messageListView.scrollTo(lastIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setInputBoxVisible(boolean visible) {
|
||||
|
@ -695,7 +699,7 @@ public class ChatView extends AnchorPane {
|
|||
private void removeListenersOnSessionChange() {
|
||||
if (chatMessages != null) {
|
||||
if (disputeDirectMessageListListener != null) chatMessages.removeListener(disputeDirectMessageListListener);
|
||||
chatMessages.forEach(msg -> msg.removeChangeListener());
|
||||
chatMessages.forEach(ChatMessage::removeChangeListener);
|
||||
}
|
||||
|
||||
if (chatMessage != null) {
|
||||
|
|
Loading…
Reference in a new issue