The following patch fixes the problems with the extra toolbar and
thesaurus. 

The first hunk (qt) is obvious and works

The second hunk (xforms) is obvious but _does_not_ work because I the
appended backtrace and assertion. The problem is that the toolbar is
created before the bufferview is initialized.

Therefore, I tried the third hunk, but it cause drawing problems (the
menu entries only appear when you move the mouse over them...).

I guess we can apply the first chunk right now, I do not know how to
deal with xforms...

JMarc

PS: the backtrace:

(gdb) run
Starting program: /local/lasgoutt/devbuild/src/./lyx 
lyx: ../../../lyx-devel/boost/boost/shared_ptr.hpp:238: class BufferView * 
boost::shared_ptr<BufferView>::operator ->() const: Assertion `px != 0' failed.

Program received signal SIGABRT, Aborted.
0x401a58d1 in __kill () from /lib/libc.so.6
(gdb) bt
#0  0x401a58d1 in __kill () from /lib/libc.so.6
#1  0x401a564d in raise (sig=6) at ../sysdeps/posix/raise.c:27
#2  0x401a6cb8 in abort () at ../sysdeps/generic/abort.c:88
#3  0x4019ed71 in __assert_fail (assertion=0x86cf02e "px != 0", 
    file=0x86cf000 "../../../lyx-devel/boost/boost/shared_ptr.hpp", line=238, 
    function=0x86cf400 "class BufferView * boost::shared_ptr<BufferView>::operator 
->() const") at assert.c:74
#4  0x082f2a32 in LyXView::buffer (this=0xbffff374)
    at ../../../lyx-devel/boost/boost/shared_ptr.hpp:238
#5  0x08148750 in LyXFunc::getStatus (this=0x88cfa90, [EMAIL PROTECTED])
    at ../../lyx-devel/src/lyxfunc.C:268
#6  0x081486cb in LyXFunc::getStatus (this=0x88cfa90, ac=3)
    at ../../lyx-devel/src/lyxfunc.C:261
#7  0x083d75d4 in Toolbar::Pimpl::add (this=0x890ea00, action=3, 
    [EMAIL PROTECTED])
    at ../../../../lyx-devel/src/frontends/xforms/Toolbar_pimpl.C:318
#8  0x083d74a4 in Toolbar::Pimpl::add (this=0x890ea00, [EMAIL PROTECTED])
    at ../../../../lyx-devel/src/frontends/xforms/Toolbar_pimpl.C:284
#9  0x082f49df in Toolbar::Toolbar (this=0x890d480, o=0xbffff374, x=2, y=33)
    at ../../../lyx-devel/src/frontends/Toolbar.C:32
#10 0x083d9ee7 in XFormsView::create_form_form_main (this=0xbffff374, 
    width=690, height=510)
    at ../../../../lyx-devel/src/frontends/xforms/XFormsView.C:142



Index: src/frontends//qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.521
diff -u -p -r1.521 ChangeLog
--- src/frontends//qt2/ChangeLog	12 Jun 2003 08:32:33 -0000	1.521
+++ src/frontends//qt2/ChangeLog	12 Jun 2003 12:01:24 -0000
@@ -1,3 +1,7 @@
+2003-06-12  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* Toolbar_pimpl.C (add): do not add unknown lfuns
+
 2003-06-12  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* QExternalDialog.C (editClicked): do not call form_->changed().
Index: src/frontends//qt2/Toolbar_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/Toolbar_pimpl.C,v
retrieving revision 1.38
diff -u -p -r1.38 Toolbar_pimpl.C
--- src/frontends//qt2/Toolbar_pimpl.C	24 May 2003 15:53:55 -0000	1.38
+++ src/frontends//qt2/Toolbar_pimpl.C	12 Jun 2003 12:01:24 -0000
@@ -264,6 +264,8 @@ void Toolbar::Pimpl::add(QToolBar * tb, 
 		tb->setHorizontalStretchable(true);
 		break;
 	default: {
+		if (owner_->getLyXFunc().getStatus(action).unknown())
+			break;
 		QPixmap p = QPixmap(toolbarbackend.getIcon(action).c_str());
 		QToolButton * button =
 			new QToolButton(p, toqstr(tooltip), "",
Index: src/frontends//xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.764
diff -u -p -r1.764 ChangeLog
--- src/frontends//xforms/ChangeLog	12 Jun 2003 08:32:33 -0000	1.764
+++ src/frontends//xforms/ChangeLog	12 Jun 2003 12:01:24 -0000
@@ -1,3 +1,7 @@
+2003-06-12  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* Toolbar_pimpl.C (add): Do not add unknown lfuns
+
 2003-06-12  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* FormExternal.C (input): do not activate Ok, Apply when clicking on
Index: src/frontends//xforms/Toolbar_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/Toolbar_pimpl.C,v
retrieving revision 1.76
diff -u -p -r1.76 Toolbar_pimpl.C
--- src/frontends//xforms/Toolbar_pimpl.C	23 May 2003 07:44:09 -0000	1.76
+++ src/frontends//xforms/Toolbar_pimpl.C	12 Jun 2003 12:01:24 -0000
@@ -315,6 +315,9 @@ void Toolbar::Pimpl::add(int action, str
 		xpos += 135;
 		break;
 	default: {
+		if (owner_->getLyXFunc().getStatus(action).unknown())
+			break;
+
 		FL_OBJECT * obj;
 
 		xpos += standardspacing;
Index: src/frontends//xforms/XFormsView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsView.C,v
retrieving revision 1.36
diff -u -p -r1.36 XFormsView.C
--- src/frontends//xforms/XFormsView.C	10 Jun 2003 14:39:45 -0000	1.36
+++ src/frontends//xforms/XFormsView.C	12 Jun 2003 12:01:24 -0000
@@ -136,16 +136,16 @@ void XFormsView::create_form_form_main(i
 	// Parameters for the appearance of the main form
 	int const air = 2;
 	int const bw = abs(fl_get_border_width());
-
-	menubar_.reset(new Menubar(this, menubackend));
-
-	toolbar_.reset(new Toolbar(this, air, 30 + air + bw));
-
 	int const ywork = 60 + 2 * air + bw;
 	int const workheight = height - ywork - (25 + 2 * air);
 
 	bufferview_.reset(new BufferView(this, air, ywork,
 		width - 3 * air, workheight));
+
+	menubar_.reset(new Menubar(this, menubackend));
+
+	toolbar_.reset(new Toolbar(this, air, 30 + air + bw));
+
 
 	minibuffer_.reset(new XMiniBuffer(*controlcommand_,
 		air, height - (25 + air), width - (2 * air), 25));

Reply via email to