Gtkmm-forge Digest, Vol 2, Issue 9



Send Gtkmm-forge mailing list submissions to
	gtkmm-forge lists sourceforge net

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.sourceforge.net/lists/listinfo/gtkmm-forge
or, via email, send a message with subject or body 'help' to
	gtkmm-forge-request lists sourceforge net

You can reach the person managing the list at
	gtkmm-forge-owner lists sourceforge net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Gtkmm-forge digest..."


gtkmm-forge is the mailing list that receives gtkmm bug reports from bugzilla.  A daily digest is sent to gtkmm-main, to encourage people to help fixing the bugs. Do not try to unsubscribe gtkmm-forge from gtkmm-list.


Today's Topics:

   1. [Bug 347857] New: The advanced printing example
      (gtkmm (bugzilla.gnome.org))
   2. [Bug 347857] The advanced printing example
      (gtkmm (bugzilla.gnome.org))


----------------------------------------------------------------------

Message: 1
Date: Tue, 18 Jul 2006 00:24:58 +0000 (UTC)
From: "gtkmm (bugzilla.gnome.org)"
	<bugzilla-daemon bugzilla gnome org>
Subject: [gtkmm bugzilla] [Bug 347857] New: The advanced printing
	example
To: gtkmm-forge lists sourceforge net
Message-ID: <bug-347857-5595 http bugzilla gnome org/>
Content-Type: text/plain; charset=utf-8

Do not reply to this via email (we are currently unable to handle email
responses and they get discarded).  You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=347857
 gtkmm | general | Ver: 2.9.x

           Summary: The advanced printing example
           Product: gtkmm
           Version: 2.9.x
          Platform: Other
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: general
        AssignedTo: gtkmm-forge lists sourceforge net
        ReportedBy: marko marko anastasov name
         QAContact: gtkmm-forge lists sourceforge net
     GNOME version: Unspecified
   GNOME milestone: Unspecified


(1) PrintFormOperation lifetime

With the silly code where ExampleWindow keeps the sigc connections, and
disconnects from them after it has run it, the behaviour is (I've been printing
to PDF in all cases):

 - it prints once succesfully
 - PFO is destroyed
 - segfaults when trying to open the print dialog once again

gdb backtrace:

0x00507385 in Gtk::PrintOperation::set_print_settings (this=0x956ca48,
print_settings= 0xbfbd64f0) at ../../gtk/gtkmm/printsettings.h:218
218       GtkPrintSettings*       gobj()       { return
reinterpret_cast<GtkPrintSettings*>(gobject_); }
(gdb) bt
#0  0x00507385 in Gtk::PrintOperation::set_print_settings (this=0x956ca48,
print_settings= 0xbfbd64f0)
    at ../../gtk/gtkmm/printsettings.h:218
#1  0x08051bbe in ExampleWindow::print_or_preview (this=0xbfbd64dc,
print_action=Gtk::PRINT_OPERATION_ACTION_PRINT_DIALOG)
    at examplewindow.cc:231
...

However, when doing this with gdb, sometimes it _is_ possible to open the
dialog twice, and the segfault occurs after a clicking on 'Print', and the
backtrace is then:

0x08051945 in ExampleWindow::on_printoperation_done (this=0xbff5e24c,
result=Gtk::PRINT_OPERATION_RESULT_APPLY, operation= 0x89e5c78)
    at /home/marko/prefix/include/glibmm-2.4/glibmm/refptr.h:179
179         pCppObject_->unreference(); // This could cause pCppObject to be
deleted.
(gdb) bt
#0  0x08051945 in ExampleWindow::on_printoperation_done (this=0xbff5e24c,
result=Gtk::PRINT_OPERATION_RESULT_APPLY, operation= 0x89e5c78)
    at /home/marko/prefix/include/glibmm-2.4/glibmm/refptr.h:179
#1  0x08053f1f in sigc::internal::slot_call1<sigc::bind_functor<-1,
sigc::bound_mem_functor2<void, ExampleWindow, Gtk::PrintOperationResult,
Glib::RefPtr<PrintFormOperation> const&>, Glib::RefPtr<PrintFormOperation>,
sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, void,
Gtk::PrintOperationResult>::call_it (rep=0x89e5c48, a_1= 0xbff5c0fc)
    at /home/marko/prefix/include/sigc++-2.0/sigc++/functors/mem_fun.h:1917
...

Using valgrind, I managed to get the second behaviour, and it also complains
about set_print_settings() a couple of times.

After some more testing, I even saw

(lt-example:18310): Gtk-CRITICAL **: gtk_print_operation_set_print_settings:
assertion `print_settings == NULL || GTK_IS_PRINT_SETTINGS (print_settings)'
failed

and conclude that somehow our m_refSettings doesn't hold a valid object after a
while (it goes away with PFO?). IIRC we have different conversions in hg files
for GtkPrintSettings*, somewhere with and somewhere without taking a reference
- I suppose this should be checked.

Anyway, that was a "digression". Now, with the disconnecting code commented,
every time a print job has finished, done handled etc, the PrintFormOperation
object is not destroyed. So they all stay alive, and on exit the program
segfaults:

** (lt-example:19367): DEBUG: ew dtor

(lt-example:19367): GLib-GObject-CRITICAL **: g_object_unref: assertion
`G_IS_OBJECT (object)' failed
** (lt-example:19367): DEBUG: pfo dtor

(lt-example:19367): GLib-GObject-CRITICAL **: g_object_unref: assertion
`G_IS_OBJECT (object)' failed
** (lt-example:19367): DEBUG: pfo dtor

0x001581e4 in sigc::internal::slot_rep::disconnect (this=0x90698e0) at
functors/slot_base.cc:50
50          (cleanup_)(data_);  // Notify the parent (might lead to destruction
of this!).
(gdb) bt
#0  0x001581e4 in sigc::internal::slot_rep::disconnect (this=0x90698e0) at
functors/slot_base.cc:50
#1  0x00158235 in sigc::internal::slot_rep::notify (data=0x90698e0) at
functors/slot_base.cc:63
#2  0x00157c2a in ~trackable_callback_list (this=0x8f85d70) at trackable.cc:89
#3  0x00157c8b in sigc::trackable::notify_callbacks (this=0xbf92adac) at
trackable.cc:67
#4  0x00157cfd in ~trackable (this=0xbf92adac) at trackable.cc:51
#5  0x0805489b in main (argc=Cannot access memory at address 0x1
) at main.cc:28

I guess PFO is trying to disconnect from EW, but EW is destroyed first.

(2) custom print preview dialog implementation

A mistery: there should be a close button next to the spin, but it doesn't show
up. It was there when I was beginning with this example and I didn't make
intentional changes, and it's all very simple anyway?!

I didn't notice a difference with PrintOperationPreview's signals commented or
not, so I kept them _un_commented.

PrintFormOperation has signal_preview_done so that ExampleWindow can get its
(PFO's) PrintSettings. If there's a better way to do it - go ahead.

So, our dialog dies very quickly. Backtrace doesn't tell much, because the
error seems to propagate deep into GTK code:

0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x007a2487 in common_render_page (op=0x89e5800, page_nr=0) at
gtkprintoperation.c:1988
#2  0x0050a24a in Gtk::PrintOperationPreview::render_page_vfunc
(this=0x89e387c, page_nr=0) at printoperationpreview.cc:456
#3  0x0050a037 in Gtk::PrintOperationPreview_Class::render_page_vfunc_callback
(self=0x89e5800, page_nr=0) at printoperationpreview.cc:169
#4  0x007a55f9 in IA__gtk_print_operation_preview_render_page
(preview=0x89e5800, page_nr=0) at gtkprintoperationpreview.c:106
#5  0x0050a17d in Gtk::PrintOperationPreview::render_page (this=0x89e387c,
page_nr=0) at printoperationpreview.cc:399
#6  0x08054d75 in PreviewDialog::on_expose_event (this=0xbff55fc4) at
previewdialog.cc:91
...

The line where it happens is

priv->start_page (op, print_context, page_setup);

It's not possible to step in, but anyway, all these objects seem to be correct.
Yet maybe (spot the question marks):

(gdb) print *priv
$1 = {action = GTK_PRINT_OPERATION_ACTION_PREVIEW, status =
GTK_PRINT_STATUS_PREPARING, error = 0x0, status_string = 0x9b6eca8 "Preparing
to print", default_page_setup = 0x9ae0160, print_settings = 0x9ad3630, job_name
= 0x9b4fdc0 "lt-example job #1", nr_of_pages = -1 ?????, current_page = -1
?????, unit = GTK_UNIT_PIXEL, export_filename = 0x0, use_full_page = 0,
track_print_status = 1, show_progress = 0, cancelled = 0, allow_async = 0,
is_sync = 1, print_pages_idle_id = 0, show_progress_timeout_id = 0,
print_context = 0x9b24508, print_pages = GTK_PRINT_PAGES_ALL, page_ranges =
0x0, num_page_ranges = 0, manual_num_copies = 0, manual_collation = 0,
manual_reverse = 0, manual_orientation = 0, manual_scale = 0, manual_page_set =
GTK_PAGE_SET_ALL, custom_widget = 0x0, custom_tab_label = 0x0, platform_data =
0x0, free_platform_data = 0, rloop = 0x0, start_page = 0, end_page = 0, end_run
= 0}

Btw set_n_pages() from PFO::on_begin_print() doesn't get called... I think we
should first clear up the relationship between PrintOperation and the "spawned"
PrintOperationPreview.

Ok, that's it for today, it's way past 2am.


-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



------------------------------

Message: 2
Date: Tue, 18 Jul 2006 06:33:14 +0000 (UTC)
From: "gtkmm (bugzilla.gnome.org)"
	<bugzilla-daemon bugzilla gnome org>
Subject: [gtkmm bugzilla] [Bug 347857] The advanced printing example
To: gtkmm-forge lists sourceforge net
Message-ID: <20060718063314 BA34C6C40F5 box gnome org>
Content-Type: text/plain; charset=utf-8

Do not reply to this via email (we are currently unable to handle email
responses and they get discarded).  You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=347857
 gtkmm | general | Ver: 2.9.x


Murray Cumming changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |murrayc murrayc com




------- Comment #1 from Murray Cumming  2006-07-18 06:33 UTC -------
Thanks for writing stuff down. I haven't read all this yet, but I'll reply
quickly to the last part:

> I think we should first clear up the relationship between PrintOperation and the "spawned" PrintOperationPreview

It's the same object. The object sends (in the signal) a pointer to its own
base class.


-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

------------------------------

_______________________________________________
Gtkmm-forge mailing list
Gtkmm-forge lists sourceforge net
https://lists.sourceforge.net/lists/listinfo/gtkmm-forge


End of Gtkmm-forge Digest, Vol 2, Issue 9
*****************************************



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]