Commit c229f904 authored by Richard Bradfield's avatar Richard Bradfield Committed by Ray Strode
Browse files

manager: fix monitor hotplug segfault

commit e5a0e92f introduced a way to
find a user session associated with a display object.

That function has a bug in it, where it skips every even
registered user session because it follows the next pointer
twice per iteration of the loop.

This can cause a crash on monitor hotplug, and in other scenarios
if there are an odd number of user sessions (since the
terminating NULL will be even and skipped over).
parent 4b03eb0f
...@@ -1126,11 +1126,10 @@ static GdmSession * ...@@ -1126,11 +1126,10 @@ static GdmSession *
get_user_session_for_display (GdmManager *self, get_user_session_for_display (GdmManager *self,
GdmDisplay *display) GdmDisplay *display)
{ {
GList *node;
for (node = self->priv->user_sessions; GList *node = self->priv->user_sessions;
node != NULL;
node = node->next) { while (node != NULL) {
GdmSession *session = node->data; GdmSession *session = node->data;
GdmDisplay *candidate_display; GdmDisplay *candidate_display;
GList *next_node = node->next; GList *next_node = node->next;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment