[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: dynamic_cast failure
From:       Josef Spillner <dr_maux () maux ! de>
Date:       2001-07-27 20:23:19
[Download RAW message or body]

On Friday 27 July 2001 13:33, Carsten Pfeiffer wrote:
> can you try a make clean? I remember Rich had such a problem with a
> dynamic_cast once, and he said it was a compilation problem.

Made kdelibs and kdebase clean, installed them again, and the problem 
remains, although it still seems it's a compile(r) problem. I created a new 
autoconf'd project as a test case and did nothing than calling createGUI(). 
Using autoconf, the crash remains. Compiling by hand is safe. Please look 
below...
The funny thing is that if I call the method on a KMainWindow directly, it 
passes, but on inherited objects (which is the normal case) the SEGV occurs.

On Friday 27 July 2001 16:48, Dirk Mueller wrote:
> which compiler/environment/KDE version are you using ?

Stock Debian potato system (gcc 2.95.2) with KDE from yesterday's CVS.


Using autoconf, automake and such doesn't work in case ONE, but works in case 
TWO:
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/kde/include 
-I/usr/local/qt/include -I/usr/X11R6.5.1/include     -O2 -fno-exceptions 
-fno-rtti -fno-check-new  -c main.cc
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/kde/include 
-I/usr/local/qt/include -I/usr/X11R6.5.1/include     -O2 -fno-exceptions 
-fno-rtti -fno-check-new  -c toplevel.cc
/bin/sh ../libtool --mode=link g++  -O2 -fno-exceptions -fno-rtti 
-fno-check-new  -s -o krashxml  main.o toplevel.o -L/usr/X11R6.5.1/lib 
-L/usr/local/qt/lib -L/usr/local/kde/lib
-L/usr/local/qt/lib -L/usr/local/kde/lib -lqt -lkdeui -lkdecore
mkdir .libs
g++ -O2 -fno-exceptions -fno-rtti -fno-check-new -s -o krashxml main.o 
toplevel.o -L/usr/X11R6.5.1/lib -L/usr/local/qt/lib -L/usr/local/kde/lib 
-L/usr/local/qt/lib -L/usr/local/kde/lib -lqt -lkdeui -lkdecore

Compiling by hand works with BOTH of the cases presented below:
gcc -o krash_not main.cc toplevel.cc -I/usr/local/kde/include 
-I/usr/local/qt/include -L/usr/local/kde/lib -L/usr/local/qt/lib -lkdecore 
-lqt -lkdeui 

That's the test class toplevel.h...
#include <kmainwindow.h>
class TopLevel : public KMainWindow {
public:
        TopLevel();
};

...and toplevel.cpp
#include "toplevel.h"
TopLevel::TopLevel()
        : KMainWindow(){
}

main.cpp - abbreviated as much as possible, e.g. killed KAboutData, doesn't 
change the behaviour!
#include <kapp.h>
#include <kcmdlineargs.h>
#include "toplevel.h"
#include <kmainwindow.h>
int main(int argc, char **argv)
{
        KCmdLineArgs::init(argc, argv, "", "", "");
        KApplication *app = new KApplication;

        TopLevel *toplevel = new TopLevel(); // case ONE
        //KMainWindow *toplevel = new KMainWindow(); // case TWO
 
        toplevel->createGUI(); // makes boom in case ONE
        app->setMainWidget(toplevel);
        return app->exec();
}

Josef

-- 
The MindX Open Source Project: Fighting proprietary games
GGZ now! - The GGZ Gaming Zone: http://ggz.sourceforge.net
ggz.morat.net | ggz.snafu.de | jzaun.com | mindx.sourceforge.net/europeone
 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic