Experiencing phantom drawing with Gtk+-3.0

Hi
As migrated my application gsequencer to Gtk±3.0, I am experiencing phantom drawing.
See attached screenshot.

The last row in the cell pattern shows you the position of the playback. There should be only 1 AgsLed drawn with “color” from GtkStyleContext.

I think the problem is the AgsLed widget gets cleared from Xorg but no draw signal is emitted.

Please, take a look at my GtkWidget::draw()

http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/widget/ags_led.c?h=3.0.x

What about calling following functions?

  • cairo_surface_flush(cairo_get_target(cr));
  • cairo_surface_mark_dirty(cairo_get_target(cr));

Note the AgsLed widget has its very own GdkWindow.

best regards,
Joël

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

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.