Report wrapper to call python scripts?
david.osguthorpe at gmail.com
Wed Dec 24 12:32:33 EST 2014
On Wed, Dec 24, 2014 at 08:38:06AM -0800, John Ralls wrote:
> > On Dec 24, 2014, at 7:38 AM, David Osguthorpe <david.osguthorpe at gmail.com> wrote:
> > (By the way note that GnuCash is multithreaded because Gtk is multi-threaded - in the initial
> > implementation attempts I had issues with python GIL crashes but these dissappeared when I started
> > using proper pygobject based implementations of GnuCashs GTypes).
> No, Gtk supports use in a multi-threaded environment, but is not itself multithreaded. In particular, Gtk requires that all calls to Gtk functions occur in a single thread, and on OSX (and perhaps Windows) that thread must be the main thread, the one in which the g_main_loop is executing. Worker threads should use idle events to coordinate with the Gtk thread.
well according to gdb on OSX there are multiple threads running (at least 3)
- and something was clobbering the Python GIL
- the stack traces all pointed back to un-coordinated writes to the python GIL - and the crashes were
all associated with menu clicks
> I'm frankly amazed that GnuCash's malformed GObjects work with PyGObject considering that they generally ignore GObject's memory management and are directly allocated and freed. Regardless, the C++ rewrite will break all of that because we're removing all GLib dependencies from everything except the GUI. OTOH, since we'll be using C++11 std::shared_ptr and std::unique_ptr for memory management the resulting Python bindings should in the end be a lot more stable than what we have now, although the SWIG folks still have some work to do to fully assimilate C++11 .
I know but I wanted something that worked now with a stable gnucash - and most of the python wont change
- only 3 modules (plus whatever you replace GKeyFile with)
- which its not clear will change as they are directly associated with
the GUI - GncPluginPage, GncHtml, GncHtmlWebKit - all other objects are handled using the existing python
> Another potential problem for your addon: WebKit keeps getting more bloated and harder to build for Windows and OSX; in both cases we're using rather old versions (1.8.3 and 1.6.2 respectively) because of the difficulty of building newer versions on those platforms. We're looking for a lighter-weight replacement. If you're just making HTML strings and handing them to WebKit, no problem, but if you're interacting directly with the WebKitGtk API you'll have to rewrite that as well.
I am just handing the HTML string to webkit - using the show_data function - this seemed to be the
plotting functions) - if you think there is a better way to inject the HTML please let me know
More information about the gnucash-devel