Re: How do I use e_passwords_ask_password() without segvs?

Srinivasa Ragavan <[email protected]>
Newsgroups gmane.comp.gnome.evolution.devel
Organization Novell Inc
Message-ID <[email protected]>
You are missing e_passwords_init (). One reason could be this.

-Srini
On Wed, 2006-04-26 at 12:27 +0200, Jules Colding wrote:
> Hi,
> 
> I am trying to invoke e_passwords_ask_password() from a standalone
> application as well as from my Calendar backend. Both attempts fails
> miserably with a segv. The segv is in gtk_icon_set_render_icon() and I
> have no idea of why this happens.
> 
> The standalone test code that calls e_passwords_ask_password() is rather
> trivial. Essentially linking all the right libraries, including all the
> right headers and just doing:
> 
> int
> main (int argc, char *argv[])
> {
> 	gboolean remember = FALSE;
> 	char *password = NULL;
> 
> 	g_type_init();
> 	g_thread_init(NULL);
> 
> 	password = e_passwords_ask_password("Enter password",
> 		   		            "Brutus", 
> 				            "profile", 
> 				            "prompt",
> 				            E_PASSWORDS_REMEMBER_NEVER,
> 				            &remember, 
> 				            NULL);
> 	return EXIT_SUCCESS;
> }
> 
> I would really appreciate any help in with this and have appended the
> (lengthly) valgrind output below.
> 
> Thanks a lot in advance,
>   jules
> 
> 
> ############### valgrind output ################
> ==11895== Memcheck, a memory error detector.
> ==11895== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
> ==11895== Using LibVEX rev 1471, a library for dynamic binary translation.
> ==11895== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
> ==11895== Using valgrind-3.1.0, a dynamic binary instrumentation framework.
> ==11895== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
> ==11895== For more details, rerun with: -v
> ==11895== 
> 
> (process:11895): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
> 
> (process:11895): GLib-GObject-CRITICAL **: g_object_get: assertion `G_IS_OBJECT (object)' failed
> ==11895== Conditional jump or move depends on uninitialised value(s)
> ==11895==    at 0xCDAFF9: g_param_value_validate (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD9B8A: g_object_set_valist (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD9FA5: g_object_set (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0x7295740: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x7295C97: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0xCD7E59: g_object_newv (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD89D8: g_object_new_valist (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD8ADF: g_object_new (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0x729560B: gtk_button_new_from_stock (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x72E120E: gtk_dialog_add_button (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x7371F1C: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0xCDA1DB: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895== 
> ==11895== Conditional jump or move depends on uninitialised value(s)
> ==11895==    at 0xCF7390: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCF4CB4: g_value_transform (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCF8F11: g_strdup_value_contents (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD9DE6: g_object_set_valist (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD9FA5: g_object_set (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0x7295740: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x7295C97: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0xCD7E59: g_object_newv (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD89D8: g_object_new_valist (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD8ADF: g_object_new (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0x729560B: gtk_button_new_from_stock (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x72E120E: gtk_dialog_add_button (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> 
> (process:11895): GLib-GObject-WARNING **: value "TRUE" of type `gboolean' is invalid or out of range for property `visible' of type `gboolean'
> 
> (process:11895): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
> 
> (process:11895): GLib-GObject-CRITICAL **: g_object_get: assertion `G_IS_OBJECT (object)' failed
> 
> (process:11895): GLib-GObject-WARNING **: value "TRUE" of type `gboolean' is invalid or out of range for property `visible' of type `gboolean'
> 
> (process:11895): GLib-GObject-CRITICAL **: g_object_get: assertion `G_IS_OBJECT (object)' failed
> ==11895== 
> ==11895== Conditional jump or move depends on uninitialised value(s)
> ==11895==    at 0x72E0818: gtk_dialog_set_alternative_button_order (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x7371F5C: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0xCDA1DB: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD7E59: g_object_newv (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD89D8: g_object_new_valist (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD8ADF: g_object_new (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0x73710A6: gtk_message_dialog_new (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x52EED17: (within /usr/lib/libedataserverui-1.2.so.6.1.2)
> ==11895==    by 0x52EE904: (within /usr/lib/libedataserverui-1.2.so.6.1.2)
> ==11895==    by 0x52EE9C4: (within /usr/lib/libedataserverui-1.2.so.6.1.2)
> ==11895==    by 0x52EFB90: e_passwords_ask_password (in /usr/lib/libedataserverui-1.2.so.6.1.2)
> ==11895==    by 0x80492B9: main (e-cal-create-brutus-account.c:173)
> 
> (process:11895): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
> 
> (process:11895): GLib-GObject-CRITICAL **: g_object_get: assertion `G_IS_OBJECT (object)' failed
> ==11895== 
> ==11895== Conditional jump or move depends on uninitialised value(s)
> ==11895==    at 0x72E9EC7: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0xCE01C8: g_cclosure_marshal_VOID__VOID (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD17A8: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD2F6C: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE4082: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE4F46: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE5108: g_signal_emit (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0x74512B1: gtk_widget_grab_focus (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x52EEF26: (within /usr/lib/libedataserverui-1.2.so.6.1.2)
> ==11895==    by 0x52EE904: (within /usr/lib/libedataserverui-1.2.so.6.1.2)
> ==11895==    by 0x52EE9C4: (within /usr/lib/libedataserverui-1.2.so.6.1.2)
> ==11895==    by 0x52EFB90: e_passwords_ask_password (in /usr/lib/libedataserverui-1.2.so.6.1.2)
> 
> (process:11895): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
> a screen for a GtkWindow before using the window
> 
> (process:11895): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
> 
> (process:11895): Pango-CRITICAL **: pango_context_set_font_description: assertion `context != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_context_set_base_dir: assertion `context != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_context_set_language: assertion `context != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_new: assertion `context != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_text: assertion `layout != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_attributes: assertion `layout != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_alignment: assertion `layout != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_ellipsize: assertion `PANGO_IS_LAYOUT (layout)' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_single_paragraph_mode: assertion `PANGO_IS_LAYOUT (layout)' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_width: assertion `layout != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_get_extents: assertion `layout != NULL' failed
> ==11895== 
> ==11895== Conditional jump or move depends on uninitialised value(s)
> ==11895==    at 0x732206D: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0xCDF838: g_cclosure_marshal_VOID__BOXED (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD17A8: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD305B: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE3EC9: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE4F46: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE6D7D: g_signal_emit_by_name (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0x73AAE75: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x73AB0C6: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x7452B9B: gtk_widget_size_request (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x728E62E: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0xCDF838: g_cclosure_marshal_VOID__BOXED (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895== 
> ==11895== Conditional jump or move depends on uninitialised value(s)
> ==11895==    at 0x728FDBD: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x732175F: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0xCDF838: g_cclosure_marshal_VOID__BOXED (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD17A8: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD305B: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE3EC9: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE4F46: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE6D7D: g_signal_emit_by_name (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0x73AAE75: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x73AB0C6: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x7452B9B: gtk_widget_size_request (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x7449A4F: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> 
> (process:11895): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
> 
> (process:11895): Pango-CRITICAL **: pango_context_set_font_description: assertion `context != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_context_set_base_dir: assertion `context != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_context_set_language: assertion `context != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_new: assertion `context != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_text: assertion `layout != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_attributes: assertion `layout != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_alignment: assertion `layout != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_ellipsize: assertion `PANGO_IS_LAYOUT (layout)' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_single_paragraph_mode: assertion `PANGO_IS_LAYOUT (layout)' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_set_width: assertion `layout != NULL' failed
> 
> (process:11895): Pango-CRITICAL **: pango_layout_get_extents: assertion `layout != NULL' failed
> 
> (process:11895): Gtk-CRITICAL **: gtk_icon_theme_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
> 
> (process:11895): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
> 
> (process:11895): Gtk-CRITICAL **: gtk_icon_size_lookup_for_settings: assertion `GTK_IS_SETTINGS (settings)' failed
> 
> (process:11895): Gtk-WARNING **: Invalid icon size 6
> 
> 
> (process:11895): Gtk-CRITICAL **: gtk_icon_theme_load_icon: assertion `GTK_IS_ICON_THEME (icon_theme)' failed
> ==11895== 
> ==11895== Invalid read of size 4
> ==11895==    at 0x732A9D8: gtk_icon_set_render_icon (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x7453A20: gtk_widget_render_icon (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x733F51F: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x733F550: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0xCDF838: g_cclosure_marshal_VOID__BOXED (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD17A8: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD305B: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE3EC9: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE4F46: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE6D7D: g_signal_emit_by_name (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0x73AAE75: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x73AB0C6: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
> ==11895== 
> ==11895== Process terminating with default action of signal 11 (SIGSEGV)
> ==11895==  Access not within mapped region at address 0x8
> ==11895==    at 0x732A9D8: gtk_icon_set_render_icon (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x7453A20: gtk_widget_render_icon (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x733F51F: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x733F550: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0xCDF838: g_cclosure_marshal_VOID__BOXED (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD17A8: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCD305B: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE3EC9: (within /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE4F46: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0xCE6D7D: g_signal_emit_by_name (in /usr/lib/libgobject-2.0.so.0.1000.2)
> ==11895==    by 0x73AAE75: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895==    by 0x73AB0C6: (within /usr/lib/libgtk-x11-2.0.so.0.800.17)
> ==11895== 
> ==11895== ERROR SUMMARY: 11 errors from 7 contexts (suppressed: 80 from 1)
> ==11895== malloc/free: in use at exit: 184,943 bytes in 3,388 blocks.
> ==11895== malloc/free: 5,818 allocs, 2,430 frees, 1,826,871 bytes allocated.
> ==11895== For counts of detected errors, rerun with: -v
> ==11895== searching for pointers to 3,388 not-freed blocks.
> ==11895== checked 1,014,148 bytes.
> ==11895== 
> ==11895== LEAK SUMMARY:
> ==11895==    definitely lost: 2,040 bytes in 1 blocks.
> ==11895==      possibly lost: 43,936 bytes in 68 blocks.
> ==11895==    still reachable: 138,967 bytes in 3,319 blocks.
> ==11895==         suppressed: 0 bytes in 0 blocks.
> ==11895== Use --leak-check=full to see details of leaked memory.
> 
> 
> _______________________________________________
> Evolution-hackers mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/evolution-hackers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.