Printing: properly claim ownership of the printing Scintilla widget

This avoids a GObject warning about unref-ing a floating object on
print termination.
This commit is contained in:
Colomban Wendling 2014-06-23 18:36:25 +02:00
parent 881ca4fa02
commit d6c980f2fc

View File

@ -349,6 +349,8 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context,
/* setup printing scintilla object */ /* setup printing scintilla object */
dinfo->sci = editor_create_widget(dinfo->doc->editor); dinfo->sci = editor_create_widget(dinfo->doc->editor);
/* since we won't add the widget to any container, assume it's ownership */
g_object_ref_sink(dinfo->sci);
scintilla_send_message(dinfo->sci, SCI_SETDOCPOINTER, 0, scintilla_send_message(dinfo->sci, SCI_SETDOCPOINTER, 0,
scintilla_send_message(dinfo->doc->editor->sci, SCI_GETDOCPOINTER, 0, 0)); scintilla_send_message(dinfo->doc->editor->sci, SCI_GETDOCPOINTER, 0, 0));
highlighting_set_styles(dinfo->sci, dinfo->doc->file_type); highlighting_set_styles(dinfo->sci, dinfo->doc->file_type);