Bug 21970 - Add a function to close the document
Summary: Add a function to close the document
Status: RESOLVED INVALID
Alias: None
Product: poppler
Classification: Unclassified
Component: glib frontend (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-27 14:26 UTC by Gian Mario Tagliaretti
Modified: 2012-10-20 13:09 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
patch (1.83 KB, patch)
2009-05-27 14:26 UTC, Gian Mario Tagliaretti
Details | Splinter Review

Description Gian Mario Tagliaretti 2009-05-27 14:26:50 UTC
Created attachment 26264 [details] [review]
patch

As explained on IRC in the python bindings land would be great to have a function to close the document that just calls g_object_unref.

About the name I've choosen poppler_document_release because *_free is never used in the python bindings world, we usually kill all the _free functions in the override file.

Would be great if this could go into 0.12, thanks in advance
Comment 1 Carlos Garcia Campos 2009-06-06 06:57:58 UTC
What does pygtk do to solve this problem with GObjects?
Comment 2 Gian Mario Tagliaretti 2009-06-06 09:29:55 UTC
Widget are destroyed by pyggobject when the mainloop closes or when the destroy method is called, tp_dealloc is called on the python object and g_object_unref is called on the C reference.

This case is different because we want to close the document even if the app is still up and running, I guess in a C app you just unref the document.
Comment 3 Benjamin Berg 2010-06-13 03:56:19 UTC
As written in https://bugs.launchpad.net/poppler-python/+bug/316722/comments/7. AFAICT the problem is that the binding generators assume that they need to g_object_ref the object created by the *_new functions.
When that happens, the last reference to the C object will not be released when python destroys its object. The fix is to tell the binding generator that the return value of the *_new function should not be g_object_ref'ed.
Comment 4 Carlos Garcia Campos 2010-07-05 02:29:22 UTC
Is this still needed? poppler (git master) has now GObject introspection support, can I assume that bindings generated using introspection will do the right thing?
Comment 5 Benjamin Berg 2012-10-20 13:09:13 UTC
Closing this report.

 1. It was a binding bug to begin with (wrong annotation)
 2. Everything works fine with the introspection bindings


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.