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

List:       kde-devel
Subject:    trivial KDE program crashing
From:       George Petri <baitfish () bigpond ! com>
Date:       2001-09-09 0:01:40
[Download RAW message or body]


Hi!

I am experienced in C++ but am a complete newbie to KDE programming.
I was wondering if anyone knows why the following program crashes _on exit_?:

#include <kmainwindow.h>
#include <kapp.h>
 
int main (int argc, char *argv [])
{
        KApplication app (argc, argv, "Test");
        KMainWindow window;
        app.setMainWidget (&window);
        window.show ();
        return app.exec ();
}

It produces the following backtrace:
0x40acae39 in wait4 () from /lib/libc.so.6
#0  0x40acae39 in wait4 () from /lib/libc.so.6
#1  0x40b2b8e0 in __check_rhosts_file () from /lib/libc.so.6
#2  0x4061030d in KCrash::defaultCrashHandler () from /usr/lib/libkdecore.so.3

#3  0x40a68008 in sigaction () from /lib/libc.so.6
#4  0x40a03ff4 in __builtin_delete () from /usr/lib/libstdc++-libc6.1-2.so.3
#5  0x407819b8 in KMainWindow::~KMainWindow () from /usr/lib/libkdeui.so.3
#6  0x4025ca04 in QWidget::close () from /usr/lib/libqt.so.2

If I make "window" a pointer, then it doesn't crash at all:

#include <kmainwindow.h>
#include <kapp.h>
 
int main (int argc, char *argv [])
{
        KApplication app (argc, argv, "Test");
        KMainWindow *window = new KMainWindow;
        app.setMainWidget (window);
        window->show ();
        return app.exec ();
}

Why is this so?  Wouldn't this cause a memory leak?

Thanks in advance,
George
 
>> Visit http://mail.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