[Glade-users] Sharing a File Chooser Dialog Box -> Segfault? - SOLVED
Dan Swain
dswain at princeton.edu
Tue Apr 24 20:26:32 EDT 2007
I managed to find a solution myself. I discovered that this was occurring
no matter what kind of window was added to my glade project. The solution:
Change the return type of the button_press_event that handles the
gtk_popup_menu to gint instead of gboolean.
On 4/24/07, Dan Swain <dswain at princeton.edu> wrote:
>
> I want to use a file chooser dialog for a few different parts of my
> application. My current method is to create a new dialog each time in code,
> but I'd rather use glade+libglade to get a nice one and share it across
> multiple instances. In spirit what I did was this:
>
> in main.h (shared across modules where dialog needs to be used):
> ...
> GtkWidget *file_dlg;
> ...
>
> in main.c (where I handle my widget lookups... the other lookups work fine
> and this is the correct name for the widget)
> ...
> file_dlg = glade_xml_get_widget(xml, "filechooserdialog1");
> ...
>
> in callbacks.c, in a callback to handle a popup menu event
> ...
> gtk_widget_show(file_dlg);
> ...
>
> The result: The code compiles fine, the program starts as usual with the
> dialog invisible (which is its default state set in glade), but then as soon
> as I right click in the area that should create the popup containing the
> menu entry that should show the file chooser, the program dies in a
> segfault. The weird part is that I get the same error even if I comment out
> the gtk_widget_show line (so the dialog isn't ever referenced in that
> module). I have another window (one that I created in glade, not a stock
> dialog) that works fine using this same framework with no errors. Any ideas
> why the file chooser dialog would cause a seg fault when it's not even being
> accessed? Is it something different about that type of dialog as opposed to
> a regular window?
>
> Thanks in advance,
> - Dan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20070424/c2e56bc8/attachment.html
More information about the Glade-users
mailing list