Dear visitor, welcome to KDE-Forum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
Segmentation fault
I have the following code:
|
Source code
|
1
2
3
4
5
|
void Window::init() {
watch = new KDirWatch(0, "sprite");
watch->addFile("../shared/position.dat");
connect(watch, SIGNAL(dirty(const QString &)), this, SLOT(filedirty(const QString &)));
}
|
For some reason this compiles but causes a segmentation fault. I have exactly the same code in another file but it works fine.
Any ideas?
IF indeed the segmantation accours in init() then the only thing that can go wrong is the allocation to KDirWatch, but I doubt that - how do oou know the segmentation is in init()?
Did you run it under a debugger, or with valgrind?
Click here! I dare ya'!!
Project Archimedes
----------------------------------------------------------
"Don't panic, and thanks for all the fish!"
Commenting out everything there stops the segmentation fault.
I just read the "tray icon" post and someone had a similar problem. It was suggested using KApplication instead of QApplication. Did that, and the program compiled but complained it was missing KCmdLineArgs::init(). Added all that information and it compiled and worked fine