On Sun, May 08, 2005 at 08:41:26PM +0100, John Levon wrote: > On Sun, May 08, 2005 at 10:37:33PM +0300, Martin Vermeer wrote: > > > But... isn't this cursor drawing and hiding an asynchronous process > > taking place every 400 msec? What happens if a drawing activity takes > > longer than 400 (800?) msec and the cursor comes back all of itself in > > the middle of it? > > Right, looks like a problem. We should just set a variable and then only > update the cursor at the end. > > john
I tried the attached. The net effect is, that the table crashes we have seen disappear, but instead we get a new crash. It is the assert in startUpdating(), signaling an overrun of the screen redraw by the keyboard input. The relevant part of the stack is (sorry for no symbols): #4 0x080a39c2 in boost::assertion_failed (expr=0x83a7458 "!updating", function=0x83a73a0 "void CoordCache::startUpdating()", file=0x83a744b "coordcache.C", line=43) at boost.C:56 #5 0x080d41ee in CoordCache::startUpdating () at stl_deque.h:126 #6 0x08069f63 in BufferView::Pimpl::update () at basic_string.h:910 #7 0x080634ba in BufferView::update () at ButtonPolicies.h:70 #8 0x08116c8d in LyXFunc::dispatch () at basic_string.h:358 #9 0x0810f77d in LyXFunc::processKeySym () at basic_string.h:358 #10 0x080698d5 in BufferView::Pimpl::workAreaKeyPress () at basic_string.h:910 Apparently we ought to be able to queue incoming keystrokes / dispatches for the duration of redraw (using, e.g., my proposed isUpdating() method in coordcache). I remember Asger suggesting this much yesterday. Suggestions how and where to do this? LyXFunc? - Martin PS NOTE the problem is _not_ the showCursor call later on in workAreaKeyPress. It's the processKeySym call followed by the dispatch chain.
Index: screen.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/screen.C,v retrieving revision 1.101 diff -u -p -r1.101 screen.C --- screen.C 11 Feb 2005 18:07:06 -0000 1.101 +++ screen.C 9 May 2005 06:21:34 -0000 @@ -122,7 +122,7 @@ SplashScreen::SplashScreen() LyXScreen::LyXScreen() - : greyed_out_(true), cursor_visible_(false) + : greyed_out_(true), cursor_visible_(false), sync_allowed_(true) { // Start loading the pixmap as soon as possible if (lyxrc.show_banner) { @@ -155,7 +155,8 @@ void LyXScreen::showCursor(BufferView & // workarea redraw having a chance to keep up. If you think // you can remove this, try selecting text with the mouse // in Qt, or holding Page Down on the User's Guide. - lyx_gui::sync_events(); + if (sync_allowed_) + lyx_gui::sync_events(); if (cursor_visible_) return; @@ -223,13 +224,13 @@ void LyXScreen::redraw(BufferView & bv, { greyed_out_ = false; workarea().getPainter().start(); - hideCursor(); + sync_allowed_ = false; paintText(bv, vi); lyxerr[Debug::DEBUG] << "Redraw screen" << endl; expose(0, 0, workarea().workWidth(), workarea().workHeight()); workarea().getPainter().end(); theCoords.doneUpdating(); - showCursor(bv); + sync_allowed_ = true; } Index: screen.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/screen.h,v retrieving revision 1.30 diff -u -p -r1.30 screen.h --- screen.h 30 Nov 2004 01:59:46 -0000 1.30 +++ screen.h 9 May 2005 06:21:34 -0000 @@ -86,6 +86,9 @@ private: /// is the cursor currently displayed bool cursor_visible_; + + /// + bool sync_allowed_; }; #endif // SCREEN_H
pgpslJ6Q4voWc.pgp
Description: PGP signature