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

Allow disabling the public-server-list #4316

Merged
merged 2 commits into from Jul 9, 2020

Conversation

TimMThomas
Copy link

@TimMThomas TimMThomas commented Jun 26, 2020

This implements #4070 and makes it possible to hide the public-server-list from the connect dialog.
The save location was left under ui for backwards compatibility.

This is a follow-up on #4305

@Popkornium18
Copy link
Contributor

Not entirely sure but I think your changes are conflicting with mine which introduced some usages of the bool you renamed. I think you need to rebase from master and rename these too.

@TimMThomas
Copy link
Author

Yea, saw that, im on it

@TimMThomas
Copy link
Author

I think this should be it. However when i check the option and reopen the connection menu, mumble crashes. The Warning that the public list is disabled is printed. Can anyone replicate this?

@Popkornium18
Copy link
Contributor

Popkornium18 commented Jun 26, 2020

My guess is that since qlPublicServers is static it still has items once you reopen the connect dialog.

foreach(QTreeWidgetItem *qtwi, qlNew) {
ServerItem *si = static_cast<ServerItem *>(qtwi);
qtwServers->siPublic->addServerItem(si);
filterServer(si);
startDns(si);
}

Then this gets executed because there are public servers in the list. But since siPublic has been set to NULL this leads to a crash.

Disabling the public list should probably also clear qlPublicServers.

Edit: Eh, probably not exactly that since that function shouldn't be called but it smells like that null pointer is dereferenced.

@TimMThomas
Copy link
Author

Jep, its a segmentation fault.

if (bAllowFilters) {
switch (g.s.ssFilter) {
case Settings::ShowPopulated:
qcbFilter->setCurrentText(tr("Show Populated"));
break;
case Settings::ShowAll:
qcbFilter->setCurrentText(tr("Show All"));
break;
default:
qcbFilter->setCurrentText(tr("Show Reachable"));
break;
}
} else {
qcbFilter->setEnabled(false);
}

if i add an "&& !g.s.bDisablePublicList" to the if it works fine. Would that also be solved by clearing the qlPublicServers? (Besides it being a good idea anyways)

@Popkornium18
Copy link
Contributor

The text change is probably calling this slot.

void ConnectDialog::on_qcbFilter_currentIndexChanged(int filterIndex) {
const QString filter = qcbFilter->itemText(filterIndex);
if (filter == tr("Show All")) {
g.s.ssFilter = Settings::ShowAll;
} else if (filter == tr("Show Reachable")) {
g.s.ssFilter = Settings::ShowReachable;
} else if (filter == tr("Show Populated")) {
g.s.ssFilter = Settings::ShowPopulated;
}
filterPublicServerList();
}

Which is then trying to filter the public server list and dereferencing the nullpointer here.

foreach(ServerItem * const si, qtwServers->siPublic->qlChildren) {
filterServer(si);
}

Also it looks like I used spaces for tabs there 🤦

@TimMThomas
Copy link
Author

TimMThomas commented Jun 26, 2020

So, i dont really know what the best approach would be. I could add a toggled function to the checkbox, or i think it could work if i clear it in the NetworkConfig::save(). I dont really feel comfortable with both, any suggestions?

@Popkornium18
Copy link
Contributor

I would check if the public list is disabled before calling filterPublicServerList() which solves the crashing issue. You could clear qlPublicServers when the box is checked. It's not strictly necessary since nothing is done with it if the public server list is disabled, but why keep it if it's not needed.

@TimMThomas
Copy link
Author

alright, added the check, since im new to qt im still struggling with adding the action to the checkbox, I will try to do this on the weekend :)

@Krzmbrzl Krzmbrzl changed the title Allow disabling the public-server-list WIP: Allow disabling the public-server-list Jun 26, 2020
@Krzmbrzl Krzmbrzl linked an issue Jun 28, 2020 that may be closed by this pull request
@TimMThomas
Copy link
Author

After messing a bit around i came to the conclusion that qlPublicServers should be anyway destroyed after the ConnectDialog closes/gets destroyed. So i think it shouldnt be necessary to do that. Then the pr should be ready like it is?

@TimMThomas TimMThomas changed the title WIP: Allow disabling the public-server-list Allow disabling the public-server-list Jun 30, 2020
src/mumble/ConnectDialog.cpp Outdated Show resolved Hide resolved
src/mumble/NetworkConfig.ui Outdated Show resolved Hide resolved
src/mumble/Settings.cpp Outdated Show resolved Hide resolved
src/mumble/Settings.cpp Outdated Show resolved Hide resolved
src/mumble/Settings.h Show resolved Hide resolved
@Krzmbrzl Krzmbrzl added feature-request This issue or PR deals with a new feature client labels Jul 1, 2020
@Krzmbrzl
Copy link
Member

Krzmbrzl commented Jul 1, 2020

Oh and for your commit message, I think this slightly altered version would be better (plus I fixed a few typos):

FEAT(settings): Allow disabling of the public server list

This commit makes it possible to hide the public server list from the connect dialog.
The setting's group was left to be "ui" for backwards compatibility (even though the
actual setting is part of the network settings in the UI).

Implements #4070

@Krzmbrzl Krzmbrzl added this to the 1.4.0 milestone Jul 1, 2020
@Popkornium18
Copy link
Contributor

After messing a bit around i came to the conclusion that qlPublicServers should be anyway destroyed after the ConnectDialog closes/gets destroyed. So i think it shouldnt be necessary to do that. Then the pr should be ready like it is?

It shouldn't be cleared when the dialog gets closed as that would require the server list to be downloaded every time the connect dialog is opened, which is unneccessary. But as I said, it isn't a big deal. It's no privacy risk, it's just some memory that could be freed. But once the client is restarted there will be no difference as the list will not get populated in the first place.

@Krzmbrzl
Copy link
Member

Krzmbrzl commented Jul 1, 2020

I guess the saved memory is not noticeable on any system though, so I think that's okay :)

@TimMThomas
Copy link
Author

TimMThomas commented Jul 5, 2020

Added the changes you requested. And yep, i feel like im blind, didnt saw that the list is static 😅
On another note: thank you guys for your help :)

Edit: The CI for macOS failed when setting up the build environment, i dont think the changes i made should break anything hmm

@Krzmbrzl
Copy link
Member

Krzmbrzl commented Jul 8, 2020

We had some issues with the macOS CI (see #4349) - I rebased your branch against the current master brach and now all CIs should succeed. After that I think we can merge this PR :)

Tim-Marek Thomas added 2 commits July 8, 2020 18:21
This commit makes it possible to hide the public server list from the connect dialog.
The setting's group was left to be "ui" for backwards compatibility (even though the
actual setting is part of the network settings in the UI).

Implements mumble-voip#4070
Updating 'mumble_en.ts'...
    Found 1884 source text(s) (2 new and 1882 already existing)
@Krzmbrzl
Copy link
Member

Krzmbrzl commented Jul 8, 2020

(I also fixed some whitespace issue while I was on it - you had mixed indentation with tabs and with spaces)

@Krzmbrzl Krzmbrzl merged commit 180f44f into mumble-voip:master Jul 9, 2020
@Krzmbrzl
Copy link
Member

Krzmbrzl commented Jul 9, 2020

Thank you for your contribution! :)

@TimMThomas
Copy link
Author

Alright, thank you all for you help! :)

@Krzmbrzl
Copy link
Member

Krzmbrzl commented Jul 9, 2020

You're welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client feature-request This issue or PR deals with a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to disable the public list of servers.
3 participants