Skip to content

Commit

Permalink
Fix race condition when setting GIO channel
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq committed Nov 8, 2022
1 parent 10fe68e commit 126b05e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/platform/Linux/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ CHIP_ERROR RunWiFiIPChangeListener()
}

GIOChannel * ch = g_io_channel_unix_new(sock);
g_io_add_watch_full(ch, G_PRIORITY_DEFAULT, G_IO_IN, WiFiIPChangeListener, nullptr, nullptr);

g_io_channel_set_close_on_unref(ch, TRUE);
g_io_channel_set_encoding(ch, nullptr, nullptr);

g_io_add_watch_full(ch, G_PRIORITY_DEFAULT, G_IO_IN, WiFiIPChangeListener, nullptr, nullptr);
g_io_channel_unref(ch);

return CHIP_NO_ERROR;
Expand Down

0 comments on commit 126b05e

Please sign in to comment.