Add thread assertions to Widget

This commit is contained in:
Max Weber
2018-10-01 23:02:05 -06:00
parent 6db26f7d38
commit b559a6b1af

View File

@@ -113,6 +113,8 @@ public abstract class RSWidgetMixin implements RSWidget
@Override
public int getParentId()
{
assert client.isClientThread();
int rsParentId = getRSParentId();
if (rsParentId != -1)
{
@@ -198,6 +200,8 @@ public abstract class RSWidgetMixin implements RSWidget
@Override
public boolean isHidden()
{
assert client.isClientThread();
if (isSelfHidden())
{
return true;
@@ -359,6 +363,8 @@ public abstract class RSWidgetMixin implements RSWidget
@Override
public Widget[] getNestedChildren()
{
assert client.isClientThread();
if (getRSParentId() == getId())
{
// This is a dynamic widget, so it can't have nested children
@@ -494,6 +500,8 @@ public abstract class RSWidgetMixin implements RSWidget
@Override
public Widget createChild(int index, int type)
{
assert client.isClientThread();
RSWidget w = client.createWidget();
w.setType(type);
w.setParentId(getId());
@@ -537,6 +545,8 @@ public abstract class RSWidgetMixin implements RSWidget
@Override
public void revalidate()
{
assert client.isClientThread();
client.revalidateWidget(this);
}
@@ -544,6 +554,8 @@ public abstract class RSWidgetMixin implements RSWidget
@Override
public void revalidateScroll()
{
assert client.isClientThread();
client.revalidateWidget(this);
client.revalidateWidgetScroll(client.getWidgets()[TO_GROUP(this.getId())], this, false);
}