Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[don’t merge] Add locks for countlabels in cardslist #11849

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

phughk
Copy link
Contributor

@phughk phughk commented Feb 24, 2024

This is related to #11848

The diff introduces a read write lock to the code for the countlist.

The count list is not accessed as reads only write locks in the diff.

This should prevent the error from occuring as far as I can see.

@JayDi85
Copy link
Member

JayDi85 commented Feb 24, 2024

Is it reproduce able in every try or it's a random error?

As info:

Swing (GUI library) thread process all GUI related code in single thread by messages/events queue. So any modification must be done in same thread (or be a thread safe, synchronized, etc).

There are two tools for it:

  • ThreadUtils.ensureRunInGUISwingThread() -- make sure your code running in swing thread (it allows to find some bad use cases);
  • SwingUtilities.invokeLater(() -> {xxx}) -- execute code in swing thread. All GUI modification code must be called from it. By default any panels and other GUI related methods run in swing thread already. But some third party events must be not (example: game events from a server);

So maybe it need more research and fix of the original code/event processing. Original error starts here due stack (double clicks):

shot_240224_164916

@phughk
Copy link
Contributor Author

phughk commented Feb 24, 2024

Is it reproduce able in every try or it's a random error?

I had 3 drafts fail when I was "playing seriously" and 1 succeed when I was just picking first card available and random deck from drafted.

There are two tools for it:

Ah, so actually you mean this is a threading issue? As in the threads should not be outside the GUI thread and throw exceptions? Can try fixing that thank you

@JayDi85 JayDi85 self-assigned this Feb 24, 2024
@phughk
Copy link
Contributor Author

phughk commented Feb 26, 2024

Ticket status: needs investigation as per @.JayDi85 's comment

@JayDi85 JayDi85 changed the title Add locks for countlabels in cardslist [don’t merge] Add locks for countlabels in cardslist Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants