Steve Donovan wrote: >It seems that the SciTEGTK destructor isn't called, because gtk_main() >never returns. The culprit is the use of gtk_exit(0) for normal >program exit. If one replaces gtk_exit(0) with gtk_main_quit() >in SciTEGTK::QuitProgram() and SciTEGTK::QuitSignal(), >then gtk_main() returns and the destructor gets called.
I noticed this this week end too, as I was trying to fix the following bug: you can't paste text cut or copied from SciTE after it has been closed. I added calls to gtk_clipboard_set_can_store() in Scintilla, but it still didn't work. That's when I noticed that gtk_main_quit() wasn't called, because it is supposed to automatically store the clipboard text on application exit. I then noticed that we have two exit functions, QuitProgram() which is called if you select quit from the menu, and QuitSignal() which is called when you close the window (say, by Alt+F4). I've researched the history of the two functions (thanks to Sourceforge's CVS browser). Initially QuitSignal() was calling Command(IDM_QUIT) or something like that. Patches for single instance and Director interface (btw, why is the documentation saying the Director interface only exists for Windows? it is confusing to read the code I'm looking at doesn't exist...) introduced changes. I made a page with my findings, unfortunately I'm not home now, so I can't send it. I'll try to do that tonight. I'm unsure how the stuff with pipes work. Why the preprocessor directives? Does the single instance use the director pipes when the director extension is activated? are the director pipes are only removed if SciTE is closed from the menu? That'd be another bug. I thought the code might be changed in the following way. Create a DestroySignal() function that would clean up any pipes (unless you want to move that elsewhere) and call gtk_main_quit(). Register that function to the destroy event on the main window. Change QuitSignal() (which is registered on the delete event) to only call QuitProgram() - you might need to return TRUE. Modify QuitProgram(), removing the stuff to clean up pipes and make it destroy the main window unless the user has clicked cancel. Oh, and the GTK documentation states that gtk_exit() should not be used, so we might replace the calls left (those who are not in QuitSignal() or QuitProgram()) with simple exit()s. They are not in the GTK main loop, I think, so it shouldn't be necessary to call gtk_main_quit(). Hope everybody understands what I mean. Nicolas _______________________________________________ Scite-interest mailing list [email protected] http://mailman.lyra.org/mailman/listinfo/scite-interest
