Subj : Re: synchronisation of js runtime To : Timm Coerrens From : Brendan Eich Date : Wed Dec 31 1969 04:00 pm Timm Coerrens wrote: > Hi, > > My app uses gecko as GUI for a c++-application. I manipulate the DOM > through XPConnect in order to show some content (html). I also use > some javascript functions in the html-code for image-changing and > others. I now want to know, if i can synchronize the access to the > DOM, so that js and c++ runtime don't interfere. Now sometimes the > engine crashes (NetscapeDispatchWnd) With what stack backtrace? Is your code involved? > when the access from c++-side is too fast (js hasn't completed its > action before c++-access). I think i have to get control over the > js-runtime. > > Example: onMouseDown="imagechange();" > onMouseUp="imagechange();sendIt(this.id);" > > 'sendIt' makes the connection to the application thread, which then > evaluates the id and generates some new content (DOM). I thought, when > sendIt is the last function, the js-function imagechange() has > finished. Sometimes it hasn't, and the application thread tries to > modify the DOM too, what causes a crash. > > Can someone help me with this? Is there a synchronization method for > this? What does synchronization (between threads, or clocks) have to do with anything? If your code is running in the same thread as the DOM code (which it must), then there is no synchronization problem. Please use mozilla.dom for DOM questions -- not cross-post with followup-to: set. /be > > > greetings > Timm > .