Application doesn't end on Linux Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
fbronx
Knows some wx things
Knows some wx things
Posts: 38
Joined: Tue Nov 29, 2005 8:37 am
Location: Belgium

Application doesn't end on Linux

Post by fbronx » Tue Jun 19, 2007 7:24 pm

When I run my wxWidgets (version 2.8.3) console program on Linux I always have to press Ctrl-C to exit. Even when my OnInit method of the application returns false.

On Windows I don't have this problem.

Any idea what's different on these platforms?
Use wxWidgets in JavaScript: GLUEscript

fbronx
Knows some wx things
Knows some wx things
Posts: 38
Joined: Tue Nov 29, 2005 8:37 am
Location: Belgium

Post by fbronx » Tue Jun 19, 2007 7:41 pm

And when I debug the application I see this in the call stack:

Code: Select all

gdb Debugger (19/06/07 21:39) (Suspended)	
	Thread [1] (Suspended: Signal 'SIGINT' received. Description: Interrupt.)	
		4 __kernel_vsyscall()  0xffffe410	
		3 __lll_mutex_lock_wait()  0xb754901e	
		2 _L_mutex_lock_49()  0xb7545673	
		1 <symbol is not available> 0x00000000	
It seems that there is one thread that's waiting for a lock.
Use wxWidgets in JavaScript: GLUEscript

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: Application doesn't end on Linux

Post by Auria » Wed Jun 20, 2007 12:12 am

Please explain what type of app it is, how/when it is supposed to exit, and what codr you use for that.

fbronx
Knows some wx things
Knows some wx things
Posts: 38
Joined: Tue Nov 29, 2005 8:37 am
Location: Belgium

Post by fbronx » Wed Jun 20, 2007 7:02 am

The code can be viewed here:

http://wxjs.svn.sourceforge.net/viewvc/ ... iew=markup

Even when OnInit returns false, I have to press Ctrl-C
Use wxWidgets in JavaScript: GLUEscript

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Fri Jun 22, 2007 1:44 am

From wxWIdgets docs
OnExit is called after destroying all application windows and controls
Your code:

Code: Select all

int App::OnExit()
  178 {
  179         while ( !wxTopLevelWindows.empty() )
  180         {
  181             // do not use Destroy() here as it only puts the TLW in pending list
  182             // but we want to delete them now
  183             delete wxTopLevelWindows.GetFirst()->GetData();
  184         }
  185     engine->FreeContext(cx);
  186     return 0;
  187 }
doesn't seem to make too much sense to me... these windows are supposed to be already destroyed when OnExit is called, you should rather make use of destructors than manually delete the data...

Post Reply