Re: [gtk-list] Gtk_MenuFactory Problem.



Marsel Osipov <marsel@lex.infi.net> writes:
>     I have this problem with gtk-- Gtk_MenuFactory.
> 
> I have two example programs.
> 
> The MyWin() classes are almost identical in both.
> 
> subfactory = new Gtk_MenuFactory(GTK_MENU_FACTORY_MENU_BAR);
> mbar = new Gtk_MenuBar(GTK_MENU_BAR(subfactory->c_object()->widget); is the
> line that gives me problem(I think).
> 
> One program compiles and runs fine, but the other, gives compiles fine, but
> when run, gives me bunch of warnings, and exits with sigsegv cought. I can not
> see why it does that....Can someone please help?

It would help, if you told what are the warnings. :)

Well, I'd guess in some reason the widget-member has not been initialized
or maybe with different type. I think you can only use the widget member
after realize() for menufactory has been made. (I dunno exactly).
Check where that widget member in the working example has proper value,
but the another code does not have it initialized. (the example in gtk--
uses add_subfactory and add_entries calls after creating the subfactory.
I think those need to be done (not sure about this either, but it sounds
logical as all examples does it)

hmm, maybe I should modify the interface to menufactory so that it'd force
you to do it correctly. (you can force that with C++'s types..)

(is there elsewhere in gtk/gtk-- situations that must be done in
certain order or it'll break? Maybe If I knew those situatiohns,
could help compiler catch those.)

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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