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.
KMimeType::iconForURL segmentation fault??
I'm trying to get an icon by a filename, but have no luck so far.
This is a simple test program and it produces a segmentation fault. I have no clue why.
|
Source code
|
1
2
3
4
5
6
7
8
9
10
|
#include <kmimetype.h>
#include <kurl.h>
#include <kdebug.h>
int main()
{
KURL test("/home/diederik/.vimrc");
kdDebug() << "The url is " << test << endl;
kdDebug() << "The icon is " << KMimeType::iconForURL(test) << endl;
}
|
It can be compiled with
g++ -I /opt/kde3/include -L /opt/kde3/lib/ -I $QTDIR/include/ -L $QTDIR/lib/ -l kdecore -l kio -o test1 test.cpp && ./test1
Working on
KMess, a MSN Messenger client for Linux/KDE.
This post has been edited 2 times, last edit by "vdboor" (Jul 15th 2005, 1:06pm)
Try creating a KApplication instance or at least a KInstance instance at the beginning of main().
Cheers,
_
Qt/KDE Developer
Debian User
Originally posted by anda_skoa
Try creating a KApplication instance or at least a KInstance instance at the beginning of main().
Cheers,
_
Great! It works now. Thanks a lot.
Working on
KMess, a MSN Messenger client for Linux/KDE.