On Wed, Dec 24, 2014 at 08:38:06AM -0800, John Ralls wrote:
> 
> > On Dec 24, 2014, at 7:38 AM, David Osguthorpe <david.osgutho...@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

> All of the main parts of GnuCash also operate in that one thread. WebKit, 
> however, is multi-threaded. As long as you just hand it HTML and Javascript 
> to render or execute it takes care of everything itself including posting 
> events back to Gtk via the GtkWidget you give it to draw on. That will likely 
> change in the course of the C++11 rewrite, though probably not this 
> development cycle: We first need to have code that's threadable. The current 
> code is too laden with static variables for that to be possible.
> 
> 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 [1].

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
bindings

> 
> 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
only pre-scheme place to use to inject HTML for display (and is presumably 
needed to use the Javascript
plotting functions) - if you think there is a better way to inject the HTML 
please let me know

David

_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to