[Kde-bindings] Simple KCrash question

Martin Welch martin.welch at ilkestoncooptravel.co.uk
Tue Apr 27 13:43:27 UTC 2004


Unfortunately that didn't work :(

I've tried different combinations of flags, parents and names with the
same result.

Is there a way to influence that KDE3/Qt3 is single threaded for a given
application? Running the app in gdb shows that a number of threads are
created. However, I don't know if that's KDE and/or mono.

Martin

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


On Tuesday 27 April 2004 10:48, Martin Welch wrote:
> 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;
> }

Well the logic is a bit strange in that you're creating a window in the 
polish() method of another KMainWindow, but I don't think that's wrong
in 
itself.

Each KMainWindow should have a unique name, or if you add a '#' to the
name it 
will append a number to make a unique name:

KMainWindow* w = new KMainWindow(0, "test#", WDestructiveClose);

And I think every window except the top one should have a parent:

KMainWindow* w = new KMainWindow(myparent, "test#", WDestructiveClose);

That's all I could see from looking at the code snippets - if it still
doesn't 
work, maybe post the complete source/makefile so I could try it out.

-- 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