GNOME Bugzilla – Bug 592195
--list mode fails to exit fast enough with a large enough list
Last modified: 2011-07-26 13:15:29 UTC
$ find /proj/thumbnail -type f | wc -l 410 $ find /proj/thumbnail -type f | ./zenity --list --text=Thumbnails --column=Thumbnail This takes so long to exit on my Intel(R) Pentium(R) Dual CPU T2330 @ 1.60GHz that I can easily select 4 or 5 different entries before gtk_main actually decides to return. I did not even bother to try a list with more than 10,000 items. I believe the attached patch is the correct fix. There is no point in explicitly deallocating memory when the operating system will do it much more efficiently. Similar patches are probably a good idea for the other zenity modes, but are less urgent because other modes allocate less memory.
Created attachment 141048 [details] [review] speed up exit The first hunk isn't strictly needed, but is useful for testing explicit deallocation. Without the first hunk, you can't select multiple items due to memory corruption.
Sorry for the late reply: gtk_main_quit has to be run to quit the mainloop. This is afaik the right way to quit an application.
You can call gtk_main_quit if you like. Just be sure to prevent selections of other list items after the first selection has been made. The main problem is that you can select more than one item because the shutdown process takes so long if there are many items loaded in the ListView.
Let me see if I understand, the correct should be, when you click on ok or cancel button, print the selected value in console, then exit faster enough before the user has chance to select another value right? This can be done calling g_io_channel_shutdown at the end of dialog response callback and checking in the stdin handle function if channel->is_readable is true or false and returning if false.
In your first paragraph, you have described the desired behavior. The solution proposed in your second paragraph is fine if it obtains the desired behavior. Thanks.
Commited on master!