After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 603686 - When creating a calculated value and clicking "Test" glom crashes for me.
When creating a calculated value and clicking "Test" glom crashes for me.
Status: RESOLVED FIXED
Product: glom
Classification: Other
Component: design
1.12.x
Other Linux
: Normal major
: ---
Assigned To: Murray Cumming
Murray Cumming
Depends on:
Blocks:
 
 
Reported: 2009-12-03 09:43 UTC by Andrew Ruthven
Modified: 2009-12-09 09:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
example db (14.71 KB, application/octet-stream)
2009-12-03 09:43 UTC, Andrew Ruthven
Details

Description Andrew Ruthven 2009-12-03 09:43:12 UTC
Created attachment 148989 [details]
example db

I've taken ruthven2example.glom as a base, and added a "created" field to Availability.  To reproduce this crasher:

(as developer)

Tables -> Availability -> <view details> -> Developer -> Fields -> created -> Open -> Calculate Value -> Edit -> paste:


import datetime

return datetime.date.today()

Click "Test", boom, crash.
Comment 1 Murray Cumming 2009-12-04 07:55:38 UTC
Do you see any warnings on the command line when doing this after starting Glom from a terminal?

Is this a self-built version of Glom or some official distro package?
Comment 2 Murray Cumming 2009-12-04 14:34:43 UTC
I can reproduce it.

I think it's only a problem for date fields.

Valgrind says the following, but I can't see the problem at these lines of code:
http://git.gnome.org/cgit/glom/tree/glom/libglom/python_embed/pygdavalue_conversions.c#n47
http://git.gnome.org/cgit/glom/tree/glom/python_embed/glom_python.cc#n329

==7763== Invalid read of size 4
==7763==    at 0x40C509E: pygda_value_from_pyobject (pygdavalue_conversions.c:47)
==7763==    by 0x814E370: Glom::glom_evaluate_python_function_implementation(Glom::Field::glom_field_type, Glib::ustring const&, std::map<Glib::ustring, Gnome::Gda::Value, std::less<Glib::ustring>, std::allocator<std::pair<Glib::ustring const, Gnome::Gda::Value> > > const&, Glom::Document*, Glib::ustring const&, Glib::RefPtr<Gnome::Gda::Connection> const&) (glom_python.cc:329)
==7763==    by 0x81C16E4: Glom::Dialog_FieldCalculation::on_button_test() (dialog_fieldcalculation.cc:129)
==7763==    by 0x50D052A: Glib::SignalProxyNormal::slot0_void_callback(_GObject*, void*) (slot.h:440)
==7763==    by 0x561B84C: g_cclosure_marshal_VOID__VOID (gmarshal.c:77)
==7763==    by 0x560E102: g_closure_invoke (gclosure.c:767)
==7763==    by 0x56236F0: signal_emit_unlocked_R (gsignal.c:3317)
==7763==    by 0x56243BF: g_signal_emit_valist (gsignal.c:2980)
==7763==    by 0x56248EA: g_signal_emit (gsignal.c:3037)
==7763==    by 0x4D22B41: gtk_button_clicked (gtkbutton.c:1111)
==7763==    by 0x4D24516: gtk_real_button_released (gtkbutton.c:1707)
==7763==    by 0x49B7EE8: Gtk::Button::on_released() (button.cc:752)
==7763==    by 0x49B9489: Gtk::Button_Class::released_callback(_GtkButton*) (button.cc:228)
==7763==    by 0x561B84C: g_cclosure_marshal_VOID__VOID (gmarshal.c:77)
==7763==    by 0x560C658: g_type_class_meta_marshal (gclosure.c:878)
==7763==    by 0x560E072: g_closure_invoke (gclosure.c:767)
==7763==    by 0x5622E5D: signal_emit_unlocked_R (gsignal.c:3177)
==7763==    by 0x56243BF: g_signal_emit_valist (gsignal.c:2980)
==7763==    by 0x56248EA: g_signal_emit (gsignal.c:3037)
==7763==    by 0x4D22BCF: gtk_button_released (gtkbutton.c:1103)
==7763==    by 0x4D22DC0: gtk_button_button_release (gtkbutton.c:1599)
==7763==    by 0x4A8618B: Gtk::Widget::on_button_release_event(_GdkEventButton*) (widget.cc:8038)
==7763==    by 0x4A8F641: Gtk::Widget_Class::button_release_event_callback(_GtkWidget*, _GdkEventButton*) (widget.cc:4667)
==7763==    by 0x4DECF88: _gtk_marshal_BOOLEAN__BOXED (gtkmarshalers.c:84)
==7763==    by 0x560C658: g_type_class_meta_marshal (gclosure.c:878)
==7763==    by 0x560E072: g_closure_invoke (gclosure.c:767)
==7763==    by 0x5623549: signal_emit_unlocked_R (gsignal.c:3285)
==7763==    by 0x5624435: g_signal_emit_valist (gsignal.c:2990)
==7763==    by 0x56248EA: g_signal_emit (gsignal.c:3037)
==7763==    by 0x4F23C60: gtk_widget_event_internal (gtkwidget.c:4767)
==7763==    by 0x4F2B6E8: gtk_widget_event (gtkwidget.c:4564)
==7763==    by 0x4DE4F62: gtk_propagate_event (gtkmain.c:2416)
==7763==    by 0x4DE63D4: gtk_main_do_event (gtkmain.c:1621)
==7763==    by 0x5166A2F: gdk_event_dispatch (gdkevents-x11.c:2372)
==7763==    by 0x5685DF3: g_main_context_dispatch (gmain.c:1960)
==7763==    by 0x5688EC8: g_main_context_iterate (gmain.c:2591)
==7763==    by 0x568935C: g_main_loop_run (gmain.c:2799)
==7763==    by 0x4D57FBF: gtk_dialog_run (gtkdialog.c:1090)
==7763==    by 0x49D7045: Gtk::Dialog::run() (dialog.cc:314)
==7763==    by 0x80EE785: Glom::Utils::dialog_run_with_help(Gtk::Dialog*, Glib::ustring const&) (utils_ui.cc:97)
==7763==  Address 0x4 is not stack'd, malloc'd or (recently) free'd
==7763== 
==7763== 
==7763== Process terminating with default action of signal 11 (SIGSEGV)
==7763==  Access not within mapped region at address 0x4
==7763==    at 0x40C509E: pygda_value_from_pyobject (pygdavalue_conversions.c:47)
==7763==    by 0x814E370: Glom::glom_evaluate_python_function_implementation(Glom::Field::glom_field_type, Glib::ustring const&, std::map<Glib::ustring, Gnome::Gda::Value, std::less<Glib::ustring>, std::allocator<std::pair<Glib::ustring const, Gnome::Gda::Value> > > const&, Glom::Document*, Glib::ustring const&, Glib::RefPtr<Gnome::Gda::Connection> const&) (glom_python.cc:329)
==7763==    by 0x81C16E4: Glom::Dialog_FieldCalculation::on_button_test() (dialog_fieldcalculation.cc:129)
==7763==    by 0x50D052A: Glib::SignalProxyNormal::slot0_void_callback(_GObject*, void*) (slot.h:440)
==7763==    by 0x561B84C: g_cclosure_marshal_VOID__VOID (gmarshal.c:77)
==7763==    by 0x560E102: g_closure_invoke (gclosure.c:767)
==7763==    by 0x56236F0: signal_emit_unlocked_R (gsignal.c:3317)
==7763==    by 0x56243BF: g_signal_emit_valist (gsignal.c:2980)
==7763==    by 0x56248EA: g_signal_emit (gsignal.c:3037)
==7763==    by 0x4D22B41: gtk_button_clicked (gtkbutton.c:1111)
==7763==    by 0x4D24516: gtk_real_button_released (gtkbutton.c:1707)
==7763==    by 0x49B7EE8: Gtk::Button::on_released() (button.cc:752)
==7763==    by 0x49B9489: Gtk::Button_Class::released_callback(_GtkButton*) (button.cc:228)
==7763==    by 0x561B84C: g_cclosure_marshal_VOID__VOID (gmarshal.c:77)
==7763==    by 0x560C658: g_type_class_meta_marshal (gclosure.c:878)
==7763==    by 0x560E072: g_closure_invoke (gclosure.c:767)
==7763==    by 0x5622E5D: signal_emit_unlocked_R (gsignal.c:3177)
==7763==    by 0x56243BF: g_signal_emit_valist (gsignal.c:2980)
==7763==    by 0x56248EA: g_signal_emit (gsignal.c:3037)
==7763==    by 0x4D22BCF: gtk_button_released (gtkbutton.c:1103)
==7763==    by 0x4D22DC0: gtk_button_button_release (gtkbutton.c:1599)
==7763==    by 0x4A8618B: Gtk::Widget::on_button_release_event(_GdkEventButton*) (widget.cc:8038)
==7763==    by 0x4A8F641: Gtk::Widget_Class::button_release_event_callback(_GtkWidget*, _GdkEventButton*) (widget.cc:4667)
==7763==    by 0x4DECF88: _gtk_marshal_BOOLEAN__BOXED (gtkmarshalers.c:84)
==7763==    by 0x560C658: g_type_class_meta_marshal (gclosure.c:878)
==7763==    by 0x560E072: g_closure_invoke (gclosure.c:767)
==7763==    by 0x5623549: signal_emit_unlocked_R (gsignal.c:3285)
==7763==    by 0x5624435: g_signal_emit_valist (gsignal.c:2990)
==7763==    by 0x56248EA: g_signal_emit (gsignal.c:3037)
==7763==    by 0x4F23C60: gtk_widget_event_internal (gtkwidget.c:4767)
==7763==    by 0x4F2B6E8: gtk_widget_event (gtkwidget.c:4564)
==7763==    by 0x4DE4F62: gtk_propagate_event (gtkmain.c:2416)
==7763==    by 0x4DE63D4: gtk_main_do_event (gtkmain.c:1621)
==7763==    by 0x5166A2F: gdk_event_dispatch (gdkevents-x11.c:2372)
==7763==    by 0x5685DF3: g_main_context_dispatch (gmain.c:1960)
==7763==    by 0x5688EC8: g_main_context_iterate (gmain.c:2591)
==7763==    by 0x568935C: g_main_loop_run (gmain.c:2799)
==7763==    by 0x4D57FBF: gtk_dialog_run (gtkdialog.c:1090)
==7763==    by 0x49D7045: Gtk::Dialog::run() (dialog.cc:314)
==7763==    by 0x80EE785: Glom::Utils::dialog_run_with_help(Gtk::Dialog*, Glib::ustring const&) (utils_ui.cc:97)
Comment 3 Murray Cumming 2009-12-09 09:47:33 UTC
Fixed in git master, with these commits, so it will be fixed in the next glom 1.12.x release;

2009-12-09  Murray Cumming  <murrayc@murrayc-desktop>

	Tests: Complete the test_python_execute_func_date test.

	* glom/libglom/python_embed/pygdavalue_conversions.c
	(glom_pygda_value_from_pyobject): Use g_date_new_dmy() so the GDate 
	is really completely initialized, avoiding errors about invalid dates.
	* tests/test_python_execute_func_date.cc: Check the return type and 
	value, by comparing the python result with the current date. 
	Bug is now really fixed #603686. (Andrew Ruthven)

2009-12-09  Murray Cumming  <murrayc@murrayc.com>

	Fix the crash when calling python functions that return dates.

	* glom/libglom/python_embed/pygdavalue_conversions.c
	(glom_pygda_value_from_pyobject): Call the macro PyDateTime_IMPORT here, 
	though it was already called in libglom_init(). I don't know why this 
	fixes the crash, but it does. Bug #603686. (Andrew Ruthven)

2009-12-08  Murray Cumming  <murrayc@murrayc.com>

	Tests: Added glom_evaluate_python_function_implementation() tests.

	* Makefile_tests.am:
	* tests/test_python_execute_func.cc:
	* tests/test_python_execute_func_date.cc: Added two unit tests for 
	Glom::glom_evaluate_python_function_implementation(). The date one 
	currently fails, as in bug #603686. (Andrew Ruthven)

2009-12-07  Murray Cumming  <murrayc@murrayc.com>

	Python: Trying to stop the PyDateTime_Check() crash.

	* glom/libglom/init.cc: libglom_init(): Call the PyDateTime_IMPORT 
	macro, which is needed to stop PyDateTime_Check() and PyDate_Check() 
	from crashing, at least in my simple test case. It still crashes in 
	Glom though.
	* glom/main.cc: Do not initialize Python here because Glom::init() 
	already did it, though doing it twice does not seem to be a problem.