Re: Top down layout



On 9 June 2010 06:16, Matthew Allen <list sydneyband com au> wrote:
   GtkWidget *vp = gtk_viewport_new(GTK_ADJUSTMENT(h), GTK_ADJUSTMENT(v));
   if (vp)
   {

On a tiny style point, by design gtk cannot get out of memory errors.
You can set a handler to run on out-of-mem, and allocations you
perform yourself with g_try_malloc() can test for oom, but no part of
gtk either tests, or can fail.

The reasoning (as I understand it) is that oom conditions are almost
impossible to recover from in GUI programs. If you can't allocate
enough memory for a new widget (somewhere around 100 bytes), your
chances of being able to save state or even display a warning are
almost nil.

You can set an oom handler and perhaps, depending on your app, there
are some caches you can drop safely without disturbing the GUI. Even
that is a little unlikely :-( The oom can be triggered by almost
anything and it's hard to be certain you don't have races.

John



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