tags 409490 + pending patch
stop

Hello,

On Saturday 03 February 2007 16:44, Lee Garrett wrote:
> when opening a .lpl file in one of the two mentioned file managers (on two
> different systems), labplot just crashes.

LabPlot also crashes if it is invoked on the command line with an .lpl / .lml 
file as argument. Backtraces of the crashes indicate that these happen when 
this functions are called in MainWin.cc:

> action = new
> KAction(title,icon,KShortcut(),sm,SLOT(map()),actionCollection());

> action = new
> KAction(title,icon,KShortcut(),smg,SLOT(map()),actionCollection());

These functions are indirectly called in openLPL() or openXML(). Looking at 
MainWin::MainWin() shows that sm and smg are initialized after the openLPL() 
and openXML() calls:

>     if(QFile::exists(fn) && fn.contains(".lpl"))
>         openLPL(fn);
>     else if(QFile::exists(fn) && ( fn.contains(".lml") ||
> fn.contains(".xml") )) openXML(fn);
>
>     modified = false;
>     is_fullscreen=false;
>
>     sm = new QSignalMapper(this);
>     connect(sm,SIGNAL(mapped(int)),this,SLOT(setActiveSheet(int)));
>     smg = new QSignalMapper(this);
>     connect(smg,SIGNAL(mapped(int)),this,SLOT(changeGraph(int)));

So the cause for the crashes is that KAction() is called while sm and smg are 
not initialized. An easy fix for this bug is to move the openLPL() and 
openXML() calls after the initialization of sm and smg, as for example in the 
attached patch. I will probably upload a fixed package soon.

Cheers,
-- 
Frank S. Thomas <[EMAIL PROTECTED]>           PGP public key ID: 0xDC426429
Debian Developer                            finger fst/[EMAIL PROTECTED]
Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 0xb4ee96e0 (LWP 30098)]
[KCrash handler]
#6  0xb63f9ac6 in QObject::connect () from /usr/lib/libqt-mt.so.3
#7  0xb7f28d6e in KAction::initPrivate () from /usr/lib/libkdeui.so.4
#8  0xb7f2ad5d in KAction::KAction () from /usr/lib/libkdeui.so.4
#9  0xb6f72529 in MainWin::updateSheetList (this=0x80ec3c0) at MainWin.cc:1506
#10 0xb6f7464a in MainWin::windowActivated (this=0x80ec3c0) at MainWin.cc:1356
#11 0xb7083719 in MainWin::qt_invoke (this=0x80ec3c0, _id=79, _o=0xbf8b2ec4)
    at MainWin.moc.cc:753
#12 0xb63f6f6d in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#13 0xb674f67e in QWorkspace::windowActivated () from /usr/lib/libqt-mt.so.3
#14 0xb65c147d in QWorkspace::activateWindow () from /usr/lib/libqt-mt.so.3
#15 0xb65c64e0 in QWorkspace::childEvent () from /usr/lib/libqt-mt.so.3
#16 0xb63f686c in QObject::event () from /usr/lib/libqt-mt.so.3
#17 0xb642f43c in QWidget::event () from /usr/lib/libqt-mt.so.3
#18 0xb639918a in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#19 0xb6399f43 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#20 0xb6a16ec2 in KApplication::notify () from /usr/lib/libkdecore.so.4
#21 0xb639ab11 in QApplication::sendPostedEvents ()
   from /usr/lib/libqt-mt.so.3
#22 0xb642df1c in QWidget::show () from /usr/lib/libqt-mt.so.3
#23 0xb7034a52 in Spreadsheet (this=0x8237a90, p=0x80fa8c8, m=0x80ec3c0, 
    name=0x0) at Spreadsheet.cc:110
#24 0xb6f75239 in MainWin::newSpreadsheet (this=0x80ec3c0) at MainWin.cc:1171
#25 0xb6f76a69 in MainWin::openXML (this=0x80ec3c0, [EMAIL PROTECTED])
    at MainWin.cc:2071
#26 0xb6f8908e in MainWin (this=0x80ec3c0, name=0x804cda7 "MainWindow", 
    filen=0x805e068 "/home/mrfrost/test.lml", is_part=false) at MainWin.cc:224
#27 0x0804c4a1 in main (argc=) at LabPlot.cc:48
diff --git a/src/MainWin.cc b/src/MainWin.cc
index 85d0350..bc3a83e 100644
--- a/src/MainWin.cc
+++ b/src/MainWin.cc
@@ -218,11 +218,6 @@ MainWin::MainWin(const char *name, const char *filen, bool is_part)
 		readScript(fn);
 #endif
 
-	if(QFile::exists(fn) && fn.contains(".lpl"))
-		openLPL(fn);
-	else if(QFile::exists(fn) && ( fn.contains(".lml") || fn.contains(".xml") ))
-		openXML(fn);
-
 	modified = false;
 	is_fullscreen=false;
 
@@ -231,6 +226,10 @@ MainWin::MainWin(const char *name, const char *filen, bool is_part)
 	smg = new QSignalMapper(this);
 	connect(smg,SIGNAL(mapped(int)),this,SLOT(changeGraph(int)));
 
+	if(QFile::exists(fn) && fn.contains(".lpl"))
+		openLPL(fn);
+	else if(QFile::exists(fn) && ( fn.contains(".lml") || fn.contains(".xml") ))
+		openXML(fn);
 }
 
 MainWin::~MainWin() {

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to