The problem seems to be accessing freed memory:
/* style context */
notation_edit_style_context = gtk_widget_get_style_context(GTK_WIDGET(notation_edit->drawing_area));
gtk_style_context_get_property(notation_edit_style_context,
"color",
GTK_STATE_FLAG_NORMAL,
&value);
fg_color = g_value_get_boxed(&value);
g_value_unset(&value);
gtk_style_context_get_property(notation_edit_style_context,
"background-color",
GTK_STATE_FLAG_NORMAL,
&value);
bg_color = g_value_get_boxed(&value);
g_value_unset(&value);
gtk_style_context_get_property(notation_edit_style_context,
"border-color",
GTK_STATE_FLAG_NORMAL,
&value);
border_color = g_value_get_boxed(&value);
g_value_unset(&value);
I should rather use g_value_dup_boxed()
.
So it would become:
/* style context */
notation_edit_style_context = gtk_widget_get_style_context(GTK_WIDGET(notation_edit->drawing_area));
gtk_style_context_get_property(notation_edit_style_context,
"color",
GTK_STATE_FLAG_NORMAL,
&value);
fg_color = g_value_dup_boxed(&value);
g_value_unset(&value);
gtk_style_context_get_property(notation_edit_style_context,
"background-color",
GTK_STATE_FLAG_NORMAL,
&value);
bg_color = g_value_dup_boxed(&value);
g_value_unset(&value);
gtk_style_context_get_property(notation_edit_style_context,
"border-color",
GTK_STATE_FLAG_NORMAL,
&value);
border_color = g_value_dup_boxed(&value);
g_value_unset(&value);
Free the color using g_boxed_free(GDK_TYPE_RGBA, fg_color);
as done drawing.
by Joël