Comment 18 for bug 1631745

Revision history for this message
fossfreedom (fossfreedom) wrote :

AndyRock - not quite sure I understand the valgrind

in this bit of code:

tatic gboolean
monitor_callback_delayed (gpointer user_data)
{
  MonitorCallbackInfo *info;
  MenuMonitorEventInfo *event_info;
  MenuMonitorEvent event;
  MenuMonitor *menu_monitor;

  info = (MonitorCallbackInfo *) user_data;
  menu_monitor = info->menu_monitor;

  if (info->weak_ptr)
    {
      switch (info->eflags)
        {
        case G_FILE_MONITOR_EVENT_CHANGED:
          event = MENU_MONITOR_EVENT_CHANGED;
          break;
        case G_FILE_MONITOR_EVENT_CREATED:
          event = MENU_MONITOR_EVENT_CREATED;
          break;
        case G_FILE_MONITOR_EVENT_DELETED:
          event = MENU_MONITOR_EVENT_DELETED;
          break;
        default:
          event = MENU_MONITOR_EVENT_INVALID;
        }

      if (event != MENU_MONITOR_EVENT_INVALID)
        {
          event_info = g_new0 (MenuMonitorEventInfo, 1);

          event_info->path = g_file_get_path (info->child);
          event_info->event = event;
          event_info->monitor = menu_monitor;

          menu_monitor_queue_event (event_info);
        }

    }

  g_object_unref (info->child);
  g_free (info);
  return FALSE;
}

should the info->weak_ptr be removed immediately after menu_monitor_queue_event? maybe the g_free(info) is cleaning up the object first but info->weak_ptr is being cleaned up after the info object is removed.