Commit ac909a86 authored by Theo Linkspfeifer's avatar Theo Linkspfeifer 💬 Committed by Alexander Schwinn
Browse files

Replace 'thunar_return_if_fail (THUNAR_IS_DEVICE (device))' with


standard 'if (..)' to prevent possible crashes. (Bug #13404)

('_thunar_return_if_fail' will only be executed when compiled with
debugging enabled. )

'THUNAR_IS_DEVICE()' will be used over 'device != NULL', since that call
does a bit more than checking for NULL.

Co-authored-by: Alexander Schwinn's avatarAlexander Schwinn <alexxcons@xfce.org>
parent 075086ed
Loading
Loading
Loading
Loading
+45 −39
Original line number Diff line number Diff line
@@ -1822,7 +1822,7 @@ thunar_shortcuts_view_open (ThunarShortcutsView *view,
                          THUNAR_SHORTCUTS_MODEL_COLUMN_LOCATION, &location,
                          -1);

      if (G_LIKELY (device != NULL))
      if (G_LIKELY (THUNAR_IS_DEVICE (device)))
        {
          /* start the spinner */
          child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
@@ -1909,8 +1909,9 @@ thunar_shortcuts_view_create_shortcut (ThunarShortcutsView *view)
    {
      /* determine the device/mount for the shortcut at the given tree iterator */
      gtk_tree_model_get (model, &iter, THUNAR_SHORTCUTS_MODEL_COLUMN_DEVICE, &device, -1);
      _thunar_return_if_fail (THUNAR_IS_DEVICE (device));

      if (G_LIKELY (THUNAR_IS_DEVICE (device)))
        {
          /* add the mount point to the model */
          mount_point = thunar_device_get_root (device);
          if (mount_point != NULL)
@@ -1923,6 +1924,7 @@ thunar_shortcuts_view_create_shortcut (ThunarShortcutsView *view)
          g_object_unref (G_OBJECT (device));
        }
    }
}



@@ -1976,8 +1978,9 @@ thunar_shortcuts_view_eject (ThunarShortcutsView *view)
    {
      /* determine the device/mount for the shortcut at the given tree iterator */
      gtk_tree_model_get (model, &iter, THUNAR_SHORTCUTS_MODEL_COLUMN_DEVICE, &device, -1);
      _thunar_return_if_fail (THUNAR_IS_DEVICE (device));

      if (G_LIKELY (THUNAR_IS_DEVICE (device)))
        {
          /* prepare a mount operation */
          mount_operation = thunar_gtk_mount_operation_new (GTK_WIDGET (view));

@@ -1996,6 +1999,7 @@ thunar_shortcuts_view_eject (ThunarShortcutsView *view)
          g_object_unref (G_OBJECT (mount_operation));
        }
    }
}



@@ -2052,7 +2056,7 @@ thunar_shortcuts_view_mount (ThunarShortcutsView *view)
      /* determine the file for the shortcut at the given tree iterator */
      gtk_tree_model_get (model, &iter, THUNAR_SHORTCUTS_MODEL_COLUMN_DEVICE, &device, -1);

      if (G_LIKELY (device != NULL))
      if (G_LIKELY (THUNAR_IS_DEVICE (device)))
        {
          /* start the spinner */
          child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
@@ -2118,8 +2122,9 @@ thunar_shortcuts_view_unmount (ThunarShortcutsView *view)
    {
      /* determine the device/mount for the shortcut at the given tree iterator */
      gtk_tree_model_get (model, &iter, THUNAR_SHORTCUTS_MODEL_COLUMN_DEVICE, &device, -1);
      _thunar_return_if_fail (THUNAR_IS_DEVICE (device));

      if (G_LIKELY (THUNAR_IS_DEVICE (device)))
        {
          /* prepare a mount operation */
          mount_operation = thunar_gtk_mount_operation_new (GTK_WIDGET (view));

@@ -2138,6 +2143,7 @@ thunar_shortcuts_view_unmount (ThunarShortcutsView *view)
          g_object_unref (G_OBJECT (mount_operation));
        }
    }
}