Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Clone WidgetPlacement before sending to VR render thread to prevent concurrent access. #2038

Merged
merged 1 commit into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1055,15 +1055,9 @@ public int newWidgetHandle() {


public void addWidgets(final Iterable<? extends Widget> aWidgets) {
for (Widget widget: aWidgets) {
mWidgets.put(widget.getHandle(), widget);
((View)widget).setVisibility(widget.getPlacement().visible ? View.VISIBLE : View.GONE);
for (Widget widget : aWidgets) {
addWidget(widget);
}
queueRunnable(() -> {
for (Widget widget: aWidgets) {
addWidgetNative(widget.getHandle(), widget.getPlacement());
}
});
}

private void updateActiveDialog(final Widget aWidget) {
Expand All @@ -1087,13 +1081,17 @@ private boolean isWidgetInputEnabled(Widget aWidget) {
public void addWidget(Widget aWidget) {
mWidgets.put(aWidget.getHandle(), aWidget);
((View)aWidget).setVisibility(aWidget.getPlacement().visible ? View.VISIBLE : View.GONE);
queueRunnable(() -> addWidgetNative(aWidget.getHandle(), aWidget.getPlacement()));
final int handle = aWidget.getHandle();
final WidgetPlacement clone = aWidget.getPlacement().clone();
queueRunnable(() -> addWidgetNative(handle, clone));
updateActiveDialog(aWidget);
}

@Override
public void updateWidget(final Widget aWidget) {
queueRunnable(() -> updateWidgetNative(aWidget.getHandle(), aWidget.getPlacement()));
final int handle = aWidget.getHandle();
final WidgetPlacement clone = aWidget.getPlacement().clone();
queueRunnable(() -> updateWidgetNative(handle, clone));

final int textureWidth = aWidget.getPlacement().textureWidth();
final int textureHeight = aWidget.getPlacement().textureHeight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ public void copyFrom(WidgetPlacement w) {
this.proxifyLayer = w.proxifyLayer;
this.textureScale = w.textureScale;
this.cylinder = w.cylinder;
this.cylinderMapRadius = w.cylinderMapRadius;
this.tintColor = w.tintColor;
this.borderColor = w.borderColor;
this.name = w.name;
this.clearColor = w.clearColor;
this.cylinderMapRadius = w.cylinderMapRadius;
}

public int textureWidth() {
Expand Down