shell/screenshot: Remove unnecessary NULL check

Since commit be5f5ec9d4, the output stream is created externally and
expected to be non-NULL, so the check is now pointless (in particular
*after* calling g_object_ref() on the stream).

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1123
This commit is contained in:
Florian Müllner 2020-03-24 07:10:27 +01:00 committed by Carlos Garnacho
parent b4162afa65
commit 1bccbe7f11

View File

@ -88,10 +88,11 @@ write_screenshot_thread (GTask *result,
GCancellable *cancellable)
{
cairo_status_t status;
GOutputStream *stream;
ShellScreenshot *screenshot = SHELL_SCREENSHOT (object);
ShellScreenshotPrivate *priv;
char *creation_time;
g_autoptr (GOutputStream) stream = NULL;
g_autoptr(GdkPixbuf) pixbuf = NULL;
g_autofree char *creation_time = NULL;
g_assert (screenshot != NULL);
@ -99,12 +100,6 @@ write_screenshot_thread (GTask *result,
stream = g_object_ref (priv->stream);
if (stream == NULL)
status = CAIRO_STATUS_FILE_NOT_FOUND;
else
{
GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf_get_from_surface (priv->image,
0, 0,
cairo_image_surface_get_width (priv->image),
@ -122,14 +117,7 @@ write_screenshot_thread (GTask *result,
else
status = CAIRO_STATUS_WRITE_ERROR;
g_object_unref (pixbuf);
g_free (creation_time);
}
g_task_return_boolean (result, status == CAIRO_STATUS_SUCCESS);
g_clear_object (&stream);
}
static void