[Kde-bindings] Simple KCrash question

Martin Welch martin.welch at ilkestoncooptravel.co.uk
Tue Apr 27 09:48:22 UTC 2004


I, er, pinched this from the first kde3 app I found on kde.org to see
how to do this. As you can see I've not changed it yet.

I wondered if it's a) because I'm creating more than one top level
window which the X server is unhappy with or b) it's a multi threading
issue.

If I unravel the code essentially I'm trying two things:

First, 

CMainWindow::polish() // corresponds to SWF Form.Load
{
	KMainWindow* w = new KMainWindow(0, "test", WDestructiveClose);
	w->show();
}

This works and creates the "test" main window before the main app
window.

However, if I connect a KPopupMenu like this:

void CMainWindow::Connect(KPopupMenu* pMenu)
{
	connect( pMenu, SIGNAL(activated(int)), SLOT(OnActivated(int))
);
}

void CMainWindow::OnActivated(int id)
{
	KMainWindow* w = new KMainWindow(0, "test", WDestructiveClose);
	w->show();
}

The fault occurs in the KMainWindow c-tor in OnActivated. The difference
is that the main window is now visible - exec() is executing.

Thanks for your help Richard.

Martin

-------------------------------------
static const char description[] =
    I18N_NOOP("A KDE RSS Feed Creator.");

static const char version[] = "0.2.1";

static KCmdLineOptions options[] =
{
    KCmdLineLastOption
};

extern "C" KApplication* Application_ctor(int argc, char** argv, char*
rAppName)
{
    KAboutData about("krsseditor", I18N_NOOP("KRssEditor"), version,
description,
                     KAboutData::License_GPL, "(C) 2004 Reuben Sutton",
0, 0, "blinkdude at blinkdude.org.uk");
    about.addAuthor( "Reuben Sutton", 0, "blinkdude at blinkdude.org.uk" );
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions( options );

//	_pApp = new KApplication(argc, argv, rAppName);
	_pApp = new KApplication();

	return _pApp;
}

-----Original Message-----
From: Richard Dale [mailto:Richard_Dale at tipitina.demon.co.uk] 
Sent: 27 April 2004 09:36
To: KDE bindings for other programming languages
Subject: Re: [Kde-bindings] Simple KCrash question


On Tuesday 27 April 2004 09:19, Martin Welch wrote:
> Hi Richard,
>
> The program is running - the crash happens in a menu handler.
>
> Using gdb I get:
>
> Program received signal SIGSEGV, Segmentation fault. [Switching to 
> Thread 1092033456 (LWP 1958)] 0x415b99f5 in KAboutData::programName() 
> const () from /usr/lib/libkdecore.so.4
> (gdb) where
> #0  0x415b99f5 in KAboutData::programName() const ()
>    from /usr/lib/libkdecore.so.4
>
> Can you help with this?
It looks like KAboutData::programName() is returning a null string or 
something. So you probably haven't set it up correctly in the KAboutData

constructor - can you post the code here? It should take three strings 
appName, programName and version.

-- Richard
_______________________________________________
Kde-bindings mailing list
Kde-bindings at kde.org https://mail.kde.org/mailman/listinfo/kde-bindings




More information about the Kde-bindings mailing list