Re: Tricks of the trade


> First of all, you should get a backtrace to see which part of code
> causes that message. The message is going through function g_logv, so
> you can put a breakpoint on that and get a backtrace when it's hit.

Thanks for this tip, most useful.

It turns out that g_log was the procedure being used in this instance
(thanks to Ross for telling me off-list the set of possible breakpoints
for this problem).  I got the following stack trace:

#0  0x40d10053 in g_log () from /usr/lib/
#1  0x40bd1785 in g_type_register_static () from /usr/lib/
#2  0x40b3f673 in Glib::custom_pointer_type_register () from /usr/lib/
#3  0x0805e3e0 in Glib::Value_Pointer<Pango::FontDescription, Pango::FontDescription*>::value_type_ ()
    at typeinfo:88
#4  0x0805e150 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535)
    at value_custom.h:207
#5  0x0805e22b in global constructors keyed to _ZN11FontBrowser21PresentationListStore12columnRecordE ()
    at bind.h:1098
#6  0x0805fa35 in __do_global_ctors_aux ()
#7  0x08054891 in _init ()
#8  0x0805f96b in __libc_csu_init ()
#9  0x40e858b5 in __libc_start_main () from /lib/tls/
#10 0x08056081 in _start () at ../sysdeps/i386/elf/start.S:102

which proves that the declaration I was suspecting is indeed the
culprit.  So that is good.  However, it means that Glib::Value_Pointer
is trying to use the type system before it has been initiated.  A strip
down version of the class declaration is:

class PresentationListStore : public Gtk::ListStore {
 public :
  // . . . 
  static class ColumnRecord : public Gtk::TreeModel::ColumnRecord {
    // . . .
    Gtk::TreeModelColumn<Pango::FontDescription *> fontDescription ; // PROBLEM
    ColumnRecord ( ) {
      // . . .
      add ( fontDescription ) ;
  } columnRecord ;
  // . . . 
} ;

So the upshot of this is that it is not possible to use a
Pango::FontDescription * as a model column if there is static instance
of the column structure class.  Although I have only been using GTKmm
for a couple of weeks or so, it strikes me as totally idiomatic that you
would want a static instance of the column structure since it is
effectively a singleton.  I guess the only way round this is to have to
use a static method and dynamically allocate the object which is
irritating but I guess is the only way round this issue of correct
synchronization order?

Dr Russel Winder                +44 20 7585 2200
41 Buckmaster Road              +44 7770 465 077
London SW11 1EN, UK             russel russel org uk

Attachment: signature.asc
Description: This is a digitally signed message part

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