mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 17:59:37 +00:00
app: use the "show all" value of the shell where cursor_image is displayed.
This is an attempt to fix #12333 where from the look of the trace, the segfault may happen if it tries to dereference a NULL view->priv->shell whereas we have a view->priv->cursor_image. Even though I couldn't reproduce, I'm wondering if it may possible to have no active image display while the cursor is indeed hovering an image. Furthermore this updated code is more logical anyway, because we should use the "show all" value from the actual display shell the cursor is hovering, not from the active display shell.
This commit is contained in:
parent
89fc9c6606
commit
b13d4d9d17
3 changed files with 15 additions and 11 deletions
|
@ -91,6 +91,7 @@ struct _GimpCursorViewPrivate
|
||||||
guint cursor_idle_id;
|
guint cursor_idle_id;
|
||||||
GimpImage *cursor_image;
|
GimpImage *cursor_image;
|
||||||
GimpUnit *cursor_unit;
|
GimpUnit *cursor_unit;
|
||||||
|
gboolean cursor_show_all;
|
||||||
gdouble cursor_x;
|
gdouble cursor_x;
|
||||||
gdouble cursor_y;
|
gdouble cursor_y;
|
||||||
};
|
};
|
||||||
|
@ -747,13 +748,13 @@ gimp_cursor_view_update_selection_info (GimpCursorView *view,
|
||||||
static gboolean
|
static gboolean
|
||||||
gimp_cursor_view_cursor_idle (GimpCursorView *view)
|
gimp_cursor_view_cursor_idle (GimpCursorView *view)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (view->priv->cursor_image)
|
if (view->priv->cursor_image)
|
||||||
{
|
{
|
||||||
GimpImage *image = view->priv->cursor_image;
|
GimpImage *image = view->priv->cursor_image;
|
||||||
GimpUnit *unit = view->priv->cursor_unit;
|
GimpUnit *unit = view->priv->cursor_unit;
|
||||||
gdouble x = view->priv->cursor_x;
|
gboolean show_all = view->priv->cursor_show_all;
|
||||||
gdouble y = view->priv->cursor_y;
|
gdouble x = view->priv->cursor_x;
|
||||||
|
gdouble y = view->priv->cursor_y;
|
||||||
gboolean in_image;
|
gboolean in_image;
|
||||||
gchar buf[32];
|
gchar buf[32];
|
||||||
const Babl *sample_format;
|
const Babl *sample_format;
|
||||||
|
@ -794,7 +795,7 @@ gimp_cursor_view_cursor_idle (GimpCursorView *view)
|
||||||
color = gegl_color_new ("black");
|
color = gegl_color_new ("black");
|
||||||
if (gimp_image_pick_color (image, NULL,
|
if (gimp_image_pick_color (image, NULL,
|
||||||
int_x, int_y,
|
int_x, int_y,
|
||||||
view->priv->shell->show_all,
|
show_all,
|
||||||
view->priv->sample_merged,
|
view->priv->sample_merged,
|
||||||
FALSE, 0.0,
|
FALSE, 0.0,
|
||||||
&sample_format, pixel, &color))
|
&sample_format, pixel, &color))
|
||||||
|
@ -884,6 +885,7 @@ void
|
||||||
gimp_cursor_view_update_cursor (GimpCursorView *view,
|
gimp_cursor_view_update_cursor (GimpCursorView *view,
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
GimpUnit *shell_unit,
|
GimpUnit *shell_unit,
|
||||||
|
gboolean shell_show_all,
|
||||||
gdouble x,
|
gdouble x,
|
||||||
gdouble y)
|
gdouble y)
|
||||||
{
|
{
|
||||||
|
@ -892,10 +894,11 @@ gimp_cursor_view_update_cursor (GimpCursorView *view,
|
||||||
|
|
||||||
g_clear_object (&view->priv->cursor_image);
|
g_clear_object (&view->priv->cursor_image);
|
||||||
|
|
||||||
view->priv->cursor_image = g_object_ref (image);
|
view->priv->cursor_image = g_object_ref (image);
|
||||||
view->priv->cursor_unit = shell_unit;
|
view->priv->cursor_unit = shell_unit;
|
||||||
view->priv->cursor_x = x;
|
view->priv->cursor_show_all = shell_show_all;
|
||||||
view->priv->cursor_y = y;
|
view->priv->cursor_x = x;
|
||||||
|
view->priv->cursor_y = y;
|
||||||
|
|
||||||
if (view->priv->cursor_idle_id == 0)
|
if (view->priv->cursor_idle_id == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,7 @@ gboolean gimp_cursor_view_get_sample_merged (GimpCursorView *view);
|
||||||
void gimp_cursor_view_update_cursor (GimpCursorView *view,
|
void gimp_cursor_view_update_cursor (GimpCursorView *view,
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
GimpUnit *shell_unit,
|
GimpUnit *shell_unit,
|
||||||
|
gboolean shell_show_all,
|
||||||
gdouble x,
|
gdouble x,
|
||||||
gdouble y);
|
gdouble y);
|
||||||
void gimp_cursor_view_clear_cursor (GimpCursorView *view);
|
void gimp_cursor_view_clear_cursor (GimpCursorView *view);
|
||||||
|
|
|
@ -181,7 +181,7 @@ gimp_display_shell_update_software_cursor (GimpDisplayShell *shell,
|
||||||
&t_x, &t_y, FALSE);
|
&t_x, &t_y, FALSE);
|
||||||
|
|
||||||
gimp_cursor_view_update_cursor (GIMP_CURSOR_VIEW (cursor_view),
|
gimp_cursor_view_update_cursor (GIMP_CURSOR_VIEW (cursor_view),
|
||||||
image, shell->unit,
|
image, shell->unit, shell->show_all,
|
||||||
t_x, t_y);
|
t_x, t_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue