After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 592195 - --list mode fails to exit fast enough with a large enough list
--list mode fails to exit fast enough with a large enough list
Status: RESOLVED FIXED
Product: zenity
Classification: Core
Component: general
2.26.x
Other Linux
: Normal normal
: ---
Assigned To: Zenity Maintainers
Zenity Maintainers
Depends on:
Blocks: 591290
 
 
Reported: 2009-08-18 10:40 UTC by Joshua N Pritikin
Modified: 2011-07-26 13:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
speed up exit (1.17 KB, patch)
2009-08-18 10:43 UTC, Joshua N Pritikin
none Details | Review

Description Joshua N Pritikin 2009-08-18 10:40:58 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.
Comment 1 Joshua N Pritikin 2009-08-18 10:43:23 UTC
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.
Comment 2 Luis Medinas 2010-05-27 23:49:13 UTC
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.
Comment 3 Joshua N Pritikin 2010-05-28 16:53:01 UTC
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.
Comment 4 Arx Cruz 2011-07-25 13:32:23 UTC
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.
Comment 5 Joshua N Pritikin 2011-07-25 13:59:04 UTC
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.
Comment 6 Arx Cruz 2011-07-26 13:15:29 UTC
Commited on master!