Commit 91d07947 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

don't forget the context we were created with but rmember it as

2004-12-13  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimppdbdialog.[ch]: don't forget the context we
	were created with but rmember it as pdb_dialog->caller_context.

	* app/widgets/gimpbrushselect.c
	* app/widgets/gimpfontselect.c
	* app/widgets/gimpgradientselect.c
	* app/widgets/gimppaletteselect.c
	* app/widgets/gimppatternselect.c: use the caller_context when
	calling the temp_proc so the temp_proc's stack frame doesn't
	contain the dialog's private context (which is just a scratch
	model for the container views) but the plug-in's real context
	which is fully initialized. Fixes bug #161114.
parent d9363898
2004-12-13 Michael Natterer <mitch@gimp.org>
* app/widgets/gimppdbdialog.[ch]: don't forget the context we
were created with but rmember it as pdb_dialog->caller_context.
* app/widgets/gimpbrushselect.c
* app/widgets/gimpfontselect.c
* app/widgets/gimpgradientselect.c
* app/widgets/gimppaletteselect.c
* app/widgets/gimppatternselect.c: use the caller_context when
calling the temp_proc so the temp_proc's stack frame doesn't
contain the dialog's private context (which is just a scratch
model for the container views) but the plug-in's real context
which is fully initialized. Fixes bug #161114.
2004-12-13 Sven Neumann <sven@gimp.org>
* libgimp/gimpdrawablecombobox.c: fixed gtk-doc comment.
......
......@@ -282,8 +282,8 @@ gimp_brush_select_run_callback (GimpPdbDialog *dialog,
{
GimpBrush *brush = GIMP_BRUSH (object);
return procedural_db_run_proc (dialog->context->gimp,
dialog->context,
return procedural_db_run_proc (dialog->caller_context->gimp,
dialog->caller_context,
NULL,
dialog->callback_name,
n_return_vals,
......
......@@ -130,8 +130,8 @@ gimp_font_select_run_callback (GimpPdbDialog *dialog,
gboolean closing,
gint *n_return_vals)
{
return procedural_db_run_proc (dialog->context->gimp,
dialog->context,
return procedural_db_run_proc (dialog->caller_context->gimp,
dialog->caller_context,
NULL,
dialog->callback_name,
n_return_vals,
......
......@@ -175,8 +175,8 @@ gimp_gradient_select_run_callback (GimpPdbDialog *dialog,
pos += delta;
}
return procedural_db_run_proc (dialog->context->gimp,
dialog->context,
return procedural_db_run_proc (dialog->caller_context->gimp,
dialog->caller_context,
NULL,
dialog->callback_name,
n_return_vals,
......
......@@ -142,8 +142,8 @@ gimp_palette_select_run_callback (GimpPdbDialog *dialog,
{
GimpPalette *palette = GIMP_PALETTE (object);
return procedural_db_run_proc (dialog->context->gimp,
dialog->context,
return procedural_db_run_proc (dialog->caller_context->gimp,
dialog->caller_context,
NULL,
dialog->callback_name,
n_return_vals,
......
......@@ -134,8 +134,8 @@ gimp_pattern_select_run_callback (GimpPdbDialog *dialog,
{
GimpPattern *pattern = GIMP_PATTERN (object);
return procedural_db_run_proc (dialog->context->gimp,
dialog->context,
return procedural_db_run_proc (dialog->caller_context->gimp,
dialog->caller_context,
NULL,
dialog->callback_name,
n_return_vals,
......
......@@ -182,10 +182,10 @@ gimp_pdb_dialog_constructor (GType type,
dialog = GIMP_PDB_DIALOG (object);
g_assert (GIMP_IS_CONTEXT (dialog->context));
g_assert (GIMP_IS_CONTEXT (dialog->caller_context));
g_assert (g_type_is_a (dialog->select_type, GIMP_TYPE_OBJECT));
dialog->context = gimp_context_new (dialog->context->gimp,
dialog->context = gimp_context_new (dialog->caller_context->gimp,
g_type_name (type),
NULL);
......@@ -224,8 +224,7 @@ gimp_pdb_dialog_set_property (GObject *object,
switch (property_id)
{
case PROP_CONTEXT:
/* don't ref, see constructor */
dialog->context = g_value_get_object (value);
dialog->caller_context = g_value_dup_object (value);
break;
case PROP_SELECT_TYPE:
dialog->select_type = (GType) g_value_get_pointer (value);
......@@ -253,6 +252,12 @@ gimp_pdb_dialog_destroy (GtkObject *object)
{
GimpPdbDialog *dialog = GIMP_PDB_DIALOG (object);
if (dialog->caller_context)
{
g_object_unref (dialog->caller_context);
dialog->caller_context = NULL;
}
if (dialog->context)
{
g_object_unref (dialog->context);
......@@ -300,7 +305,8 @@ gimp_pdb_dialog_run_callback (GimpPdbDialog *dialog,
{
dialog->callback_busy = TRUE;
if (procedural_db_lookup (dialog->context->gimp, dialog->callback_name))
if (procedural_db_lookup (dialog->caller_context->gimp,
dialog->callback_name))
{
Argument *return_vals;
gint n_return_vals;
......@@ -360,9 +366,9 @@ gimp_pdb_dialogs_check_callback (GimpPdbDialogClass *klass)
list = g_list_next (list);
if (dialog->context && dialog->callback_name)
if (dialog->caller_context && dialog->callback_name)
{
if (! procedural_db_lookup (dialog->context->gimp,
if (! procedural_db_lookup (dialog->caller_context->gimp,
dialog->callback_name))
{
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
......
......@@ -41,7 +41,16 @@ struct _GimpPdbDialog
{
GimpDialog parent_instance;
/* The context we were created with. This is the context the plug-in
* exists in and must be used when calling the plug-in.
*/
GimpContext *caller_context;
/* The dialog's private context, serves just as model for the
* select widgets and must not be used when calling the plug-in.
*/
GimpContext *context;
GType select_type;
GimpObject *initial_object;
gchar *callback_name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment