Skip to content

Clear IP address textbox after clicking invite - #3566

Draft
oridbot wants to merge 7 commits into
PixelGuys:masterfrom
oridbot:invite-clear-textbox
Draft

Clear IP address textbox after clicking invite#3566
oridbot wants to merge 7 commits into
PixelGuys:masterfrom
oridbot:invite-clear-textbox

Conversation

@oridbot

@oridbot oridbot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

babies first zig line
attempt at fixing #3485

@Wunka

Wunka commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

that's some very complicated code.... I don't know if even quantum can understand that... I think you will have to split that into 100 parts \s

@oridbot

oridbot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

ill make sure to add at least 1 line of comment per letter/s

but does this look good? i copied the clear thing from the chat input code not sure if its also applicable here or if the line is in the right part of the function

Comment thread src/gui/windows/invite.zig Outdated
if (err != error.AlreadyConnected) {
std.log.err("Cannot connect user: {s}", .{@errorName(err)});
}
ipAddressEntry.clear();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not the correct place. THis would only give feedback if the user is already connected or another error appeard. The issue is describing that there should always be visual feedback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i put it in the front of the function, i think this is the right place but honestly I mainly have no clue what that "_thread" thing is

@oridbot oridbot Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok i was informed (by MrPiedPiper) this is not the way to go as we do actually need to use ipadressentry and i have to store it

@oridbot
oridbot marked this pull request as ready for review September 1, 2026 23:56
@Wunka Wunka moved this to Easy to Review in PRs to review Sep 2, 2026
Comment thread src/gui/windows/invite.zig Outdated
}

fn invite() void {
ipAddress = ipAddressEntry.currentString.items;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes no sense

Comment thread src/gui/windows/invite.zig Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ipAddressEntry.currentString.items is now empty because you cleared it.

Please actually test the invite functionality and check in the player list if it actually invited the right IP address.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, meant to put ipAddress there, i currently just test it out on the client and then copy the code to the github website so i should probably figure out how to push a change from vscode. im gonna look at the code some more to see if ipAddress is ok to use to store the entry here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still the same issue, you are clearing the memory, yet you are still using a reference to it (const storeIpAddressEntry = ipAddressEntry.currentString; is making a copy of the pointer, not the underlying memory).
This is working in your test because in reality clear doesn't change the memory, but this is an implementation detail and you are just lucky that it worked.

Since you are just starting out, I'd recommend to maybe first do something like ziglings so you understand all the basics before contributing to Cubyz and stumbling over how Zig handles memory differently from other languages.

@IntegratedQuantum IntegratedQuantum moved this from Easy to Review to In review in PRs to review Sep 6, 2026
@oridbot

oridbot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

ok im decently confident its good now

@Wunka Wunka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok im decently confident its good now

what does confident mean? I don't want to sound harsh, but have you actually now tested the code?

Comment thread src/gui/windows/invite.zig Outdated
Comment on lines +45 to +46
const storeIpAddressEntry = ipAddressEntry.currentString;
ipAddressEntry.clear();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please read into what you are actually doing here.
As quantum said, it doens't really make sense and makes very wierd behavior possible.

@oridbot
oridbot marked this pull request as draft September 12, 2026 17:05
@IntegratedQuantum IntegratedQuantum moved this from In review to WIP/not ready for review in PRs to review Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: WIP/not ready for review

Development

Successfully merging this pull request may close these issues.

3 participants