You are not logged in.

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.

vdboor

Beginner

  • "vdboor" started this thread

Posts: 30

Location: The Netherlands

Occupation: Software developer

  • Send private message

1

Friday, July 15th 2005, 1:05pm

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)


anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

2

Sunday, July 17th 2005, 6:03pm

Try creating a KApplication instance or at least a KInstance instance at the beginning of main().

Cheers,
_
Qt/KDE Developer
Debian User

vdboor

Beginner

  • "vdboor" started this thread

Posts: 30

Location: The Netherlands

Occupation: Software developer

  • Send private message

3

Monday, July 18th 2005, 12:53pm

Quoted

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.