Skip to content
Commit 7ea22f11 authored by Mike Fleetwood's avatar Mike Fleetwood Committed by Curtis Gedak
Browse files

Make GParted exit when closed before the initial load completes (#771816)

If the GParted main window is closed before the initial device load
completed gpartedbin never exits.  The main window closes but the
process sits there idle forever.  Subsequently running GParted reports
this error:
    # gparted
    The process gpartedbin is already running.
    Only one gpartedbin process is permitted.

If the user is running GParted from a desktop menu they will never see
this error so they will never know why GParted won't start any more.

More technically, it is if the main window is closed before the
Win_GParted::on_show() callback completes.

I assume the Gtk main loop doesn't setup the normal quit handling until
the on_show() callback finishes drawing the main window for the first
time.  Following this hint [1], move the initial device load from the
on_show() callback to immediately after it completes by using a run once
idle callback setup in on_show().

This looks exactly the same to the user except now gpartedbin exits when
the main window is closed during the initial device load.  Note that
GParted finished the device load before exiting.  This is exactly the
same as happens when exiting during subsequent device refreshes.

[1] How to know when a Gtk Window is fully shown?
    http://stackoverflow.com/questions/14663212/how-to-know-when-a-gtk-window-is-fully-shown

    "If you want to know when your main window appears the first time,
    it is far easier (and saner) add a g_idle_add after your show_all
    call."

Bug 771816 - GParted never exits if the main window is closed before the
             initial device load completes
parent 770ce9a9
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment