directorylist: Fix criticals if monitoring fails

g_file_monitor_directory () can fail.  We're ignoring the actual error
by passing NULL for the error argument, but we shouldn't be trying to
connect to a signal on the NULL value that gets returned on error.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
This commit is contained in:
Sergey Bugaev 2024-09-10 18:29:59 +03:00
parent 8964f6f0cc
commit 4e0a909ca9

View File

@ -798,7 +798,8 @@ gtk_directory_list_start_monitoring (GtkDirectoryList *self)
{
g_assert (self->monitor == NULL);
self->monitor = g_file_monitor_directory (self->file, G_FILE_MONITOR_WATCH_MOVES, NULL, NULL);
g_signal_connect (self->monitor, "changed", G_CALLBACK (directory_changed), self);
if (self->monitor)
g_signal_connect (self->monitor, "changed", G_CALLBACK (directory_changed), self);
}
static void