Repository navigation
network: look devices up without inserting null entries - #598
Open
abdelhaleemahmed wants to merge 1 commit into
Open
abdelhaleemahmed wants to merge 1 commit into
abdelhaleemahmed wants to merge 1 commit into
Conversation
std::map::operator[] inserts an empty shared_ptr for a missing key. get_connection() can list a device while add_network() is still creating its D-Bus proxy asynchronously. The empty entry it inserts makes the emplace() in the proxy callback a no-op, and device_added then emits the empty pointer: NetworkControlWidget::add_device() calls get_path() on it and wf-panel crashes at start-up (the backtrace in WayfireWM#495). A device looked up before add_network() runs for it is skipped as already known for the same reason. Look devices up with find() in get_connection(), DeviceRemoved, request_password() and submit_password(). See WayfireWM#495. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the start-up crash with the backtrace in #495 (
NetworkControlWidget::add_device()called with an emptystd::shared_ptr<Network>).std::map::operator[]inserts an emptyshared_ptrfor a missing key.get_connection()can list a device whileadd_network()is still creating its D-Bus proxy asynchronously; the empty entry it inserts makes theemplace()in the proxy callback a no-op, anddevice_addedthen emits the empty pointer, whichadd_device()dereferences. (If the lookup comes beforeadd_network()runs for that device, the empty entry makesadd_network()skip the device as already known.) It depends on timing, which matches the reports that the crash comes and goes and does not happen under gdb.The fix: a small
find_device()helper that looks up without inserting, used inget_connection(),DeviceRemoved,request_password()andsubmit_password(). The places that create devices are unchanged; with no empty entries in the map theiremplace()works again.I hit this crash on Rocky Linux 10 (wf-shell 0.11.0) at every login. The same fix, applied to 0.11.0, has run there since without a crash. On
masterI checked thatmanager.cppbuilds without warnings and passesuncrustify; I could not runmaster's panel there, because it needs a newer gtkmm than the distribution has.🤖 Generated with Claude Code