app: fix crash in the newly added GimpDisplayShell render_cache code
Must initialize shell->render_buf_width,height before realize(), so move the code to gimp_display_shell_init(), it doesn't depend on the shell being realized.
This commit is contained in:
parent
4c1677078e
commit
d93e928703
2 changed files with 24 additions and 23 deletions
|
|
@ -83,7 +83,6 @@ gimp_display_shell_canvas_realize (GtkWidget *canvas,
|
|||
GimpCanvasPaddingMode padding_mode;
|
||||
GimpRGB padding_color;
|
||||
GtkAllocation allocation;
|
||||
const gchar *env;
|
||||
|
||||
gtk_widget_grab_focus (canvas);
|
||||
|
||||
|
|
@ -115,28 +114,6 @@ gimp_display_shell_canvas_realize (GtkWidget *canvas,
|
|||
|
||||
/* allow shrinking */
|
||||
gtk_widget_set_size_request (GTK_WIDGET (shell), 0, 0);
|
||||
|
||||
shell->render_buf_width = 256;
|
||||
shell->render_buf_height = 256;
|
||||
|
||||
env = g_getenv ("GIMP_DISPLAY_RENDER_BUF_SIZE");
|
||||
|
||||
if (env)
|
||||
{
|
||||
gint width = atoi (env);
|
||||
gint height = width;
|
||||
|
||||
env = strchr (env, 'x');
|
||||
if (env)
|
||||
height = atoi (env + 1);
|
||||
|
||||
if (width > 0 && width <= 8192 &&
|
||||
height > 0 && height <= 8192)
|
||||
{
|
||||
shell->render_buf_width = width;
|
||||
shell->render_buf_height = height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
|
|
@ -303,6 +303,8 @@ gimp_color_managed_iface_init (GimpColorManagedInterface *iface)
|
|||
static void
|
||||
gimp_display_shell_init (GimpDisplayShell *shell)
|
||||
{
|
||||
const gchar *env;
|
||||
|
||||
shell->options = g_object_new (GIMP_TYPE_DISPLAY_OPTIONS, NULL);
|
||||
shell->fullscreen_options = g_object_new (GIMP_TYPE_DISPLAY_OPTIONS_FULLSCREEN, NULL);
|
||||
shell->no_image_options = g_object_new (GIMP_TYPE_DISPLAY_OPTIONS_NO_IMAGE, NULL);
|
||||
|
|
@ -327,6 +329,28 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
|||
shell->filter_profile = gimp_babl_get_builtin_color_profile (GIMP_RGB,
|
||||
GIMP_TRC_NON_LINEAR);
|
||||
|
||||
shell->render_buf_width = 256;
|
||||
shell->render_buf_height = 256;
|
||||
|
||||
env = g_getenv ("GIMP_DISPLAY_RENDER_BUF_SIZE");
|
||||
|
||||
if (env)
|
||||
{
|
||||
gint width = atoi (env);
|
||||
gint height = width;
|
||||
|
||||
env = strchr (env, 'x');
|
||||
if (env)
|
||||
height = atoi (env + 1);
|
||||
|
||||
if (width > 0 && width <= 8192 &&
|
||||
height > 0 && height <= 8192)
|
||||
{
|
||||
shell->render_buf_width = width;
|
||||
shell->render_buf_height = height;
|
||||
}
|
||||
}
|
||||
|
||||
shell->motion_buffer = gimp_motion_buffer_new ();
|
||||
|
||||
g_signal_connect (shell->motion_buffer, "stroke",
|
||||
|
|
|
|||
Loading…
Reference in a new issue