question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Something about Tables broke in recent Snapshot

See original GitHub issue

Excuse the vague report, I’m trying to debug on my own and figure it out to no avail.

Situation: My app was updated the other day, I had to update some Gradle dependencies, recompile, and upload to Google Play. (So the LibGDX Snapshot probably updated.) Nothing else was changed. The next day I received reports from only a couple users showing me what is in the below screenshots. Some buttons in my app’s menu are the wrong size, huge and broken in some cases.

I installed on all of my 7 test devices, no issue. I cannot reproduce this. Seemingly nobody else is reporting this issue either. I thought it a fluke, but today a couple more reported to me as well.

Even odder, a reinstall of the app fixes it, as these users have told me. The way the UI is built is absolutely not dependent with any persistent/saved properties where a reinstall would fix it. This is very bizarre.

Screenshots (notice the left-side, the top buttons are either “too big” or “take up the whole screen big”, also you’ll notice another button is seemingly shifted out of the menu horizontally as well).

I notice a common factor in the code where these buttons are added to the ScrollPane’s Table:

_undoButton = createToolTextButton(App.bundle.format("undo"), Module.getNormalButtonStyle());
add(_undoButton).align(Align.right).height(_undoButton.getHeight() * 0.75f);

public static TextButton createToolTextButton(String text, TextButtonStyle textButtonStyle)
{
	TextButton textButton = new TextButton(text, textButtonStyle);
	textButton.getLabel().setWrap(true);
	textButton.getCell(textButton.getLabel()).pad(0, 4, 0, 4);

	return textButton;
}

I modify the height by taking the height of the Button and scaling it down 0.75f. This code has been in place for years but likely something is either wrong or this is now deprecated behavior?

Similarly, the button which is shifted out of view horitontally has width-edit code:

_importStickfigureButton = createToolImageTextButton2(App.bundle.format("importStickfigure"), Module.getLargeStickfigureButtonStyle());
importTable.add(_importStickfigureButton).width(_importStickfigureButton.getWidth() * 0.75f);

And the Table object these buttons are added to is initialize like:


public void initialize(Drawable tableGrayBackground)
{
	// Setup the table.
	if (tableGrayBackground != null)
		setBackground(tableGrayBackground);
	pad(20, 0, 20, 0);
	defaults().space(0).spaceRight(10).spaceBottom(10).pad(0).align(Align.center).expandX().uniformX();
}

I notice commits were made recently to scene2d recently (https://github.com/libgdx/libgdx/commits/master/gdx/src/com/badlogic/gdx/scenes/scene2d/ui), specifically about layout() stuff (41e65e25cfd24ec72aaf01fbf1aa39e1001019b2).

I’d have to believe something is wrong in one of these recent commits. I apologize again for the vague issue report where I can’t pinpoint the exact problem, but hoping maybe the source of this problem is more apparent to one of you guys?

I’m still confused as to why this affects a very small percentage of users, and a reinstall fixes it.

Version of LibGDX and/or relevant dependencies

1.9.12-SNAPSHOT

Please select the affected platforms

  • [ X] Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
NathanSweetcommented, Sep 30, 2020

the fact Table/layout was just modified prior to this build makes me unsure.

Aye, it could very well have something to do with the recent changes. FWIW, I use Table extensive in a large app (Spine) and have done a recent release to thousands of users without layout issues, but it could be you are using it differently. My app has 1:1 pixel:stage units, which is pretty big difference.

Since your viewport setup likely doesn’t map 1:1, you may not want to use Table rounding at all. Eg say an actor is 10.5 tall in stage units and you have Table round to 11 stage units, when displayed on the screen both the 10.5 and 11 are unlikely to be mapped to an integer pixel. Since the rounding doesn’t help you avoid texture filtering, there’s not much point to doing it. Still, if the issue is with rounding we should of course figure out why it happens.

why would a reinstall fix it?

No idea, this is pretty mysterious. Maybe your UI is slightly different when refreshly installed? I wonder if just running it multiple times would have “fixed” it.

The thing is, sometimes more pairs of eyes see more things than just one pair - and, speaking of me, sometimes even my pair see new things after sleeping over it. Is there any real disadvantage of using PR and waiting some days before merging?

@MrStahlfelge It’s rare for others to pull a PR and try it out, especially for small to medium sized changes. Eg, a PR would not have helped avoid this Table issue. Generally a PR is appropriate for changes where discussion is needed about if it should be done at all or how it should be done. If I think a change needs that then I’ll make a PR, as I’ve done in the past. Otherwise, I am already the gatekeeper for the parts of libgdx I maintain. It is unreasonable to run from master and expect there to never be problems. Let’s please stop derailing this and other issues with this discussion.

0reactions
rdamianocommented, Oct 7, 2020

Well to be fair I believe you also turned off table rounding

True and I would like to test it. Though I looked at the code for rounding in Table and I don’t see anything there that would cause such wild values. Secondly, the spaceRight(10 * assetScaling) resulting in a crash due to it evaluating to <0 at random values also indicates something more voodoo-y at work. I just suspect LibGDX is fine and it was a fault on my end. But true @ what you say about the rounding thing, maybe even a static value would do the trick.

Read more comments on GitHub >

github_iconTop Results From Across the Web

New Snapshot broken Enchanting? : r/Minecraft - Reddit
With today's snapshot update, I can no longer enchant any of my items on my enchantment table. ... When something new and creative...
Read more >
Enchantment Table Broken? - Recent Updates and Snapshots
i have been enchanting books at level 30 but i keep getting very low tier enchantments and they are usually repeated or useless...
Read more >
Minecraft Snapshot 22w46a
We are now releasing snapshot 22w46a for Minecraft 1.19.3 with playable mob sounds added as an experimental feature, changes to the spawning ...
Read more >
Everything you need to know about Snapshot Fact Tables
Most nonadditive measurements, for example ratios, can be broken down into additive facts that should instead be recorded in the fact table.
Read more >
Hbase restore table from snapshot after the table is truncated
I think you should try something like this: snapshot 'TableName', 'SnapshotName' .... delete old / create new / or truncate the table, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found