Re: Displaying a popup before the main window

On Wed, 2010-09-15 at 10:30 +0100, Dave Howorth wrote:

# Process the events so the show actually does something

Gtk2->main_iteration while Gtk2->events_pending;

no, no, no. no, please, for the love of all that's sacred and good and
pure in the Universe: don't.

manually, and forcefully, spinning the main loop is the equivalent of
taking some ibuprofen to stop the headache that you get when you bang
your head against the wall to bang a nail in with your forehead. the
ibuprofen is masking the fact that *you're banging your head against the
wall to bang a nail in*.

in this case, spinning the main loop is just masking the fact that
you're blocking the main loop. the correct way to deal with this is *to
stop blocking the main loop*.

split your operations in small chunks.

use worker threads and signal the main UI thread when done.

spin off worker processes and use a pipe to feed data to them and read
back the results.

split your application in a D-Bus activated daemon and use D-Bus as the
IPC mechanism for remote object manipulation.

this particular problem space has been flogged to death, and then some,
like the proverbial horse. spinning the main loop is *not* the solution,
it's just a hack. ${DEITY}, I'd love to deprecate those functions in gtk
itself, so that people stopped abusing them and just *fixed their



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]