Commit 39cfd20e 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 1234b759
Loading
Loading
Loading
Loading
+45 −39
Original line number Diff line number Diff line
@@ -1799,7 +1799,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));
@@ -1886,8 +1886,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)
@@ -1900,6 +1901,7 @@ thunar_shortcuts_view_create_shortcut (ThunarShortcutsView *view)
          g_object_unref (G_OBJECT (device));
        }
    }
}



@@ -1953,8 +1955,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));

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



@@ -2030,7 +2034,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));
@@ -2096,8 +2100,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));

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