Re: [Planner Dev] Last patch for undo resource dialog: undo calendar selection



On lör, 2004-05-01 at 12:54 +0000, Alvaro del Castillo wrote:
> Hi guys!
> 
> Here goes the last patch, if we don't find some prob, to implement the
> undo system in the resource dialog. It implements undoing the calendar
> selection.
> 
> Also I have found a bug that crash planner undoing the note in the
> resource note editor and it is solved with this patch also (using a
> DialogData when it could be destroyed to store data).

The patch looks good, except for one thing, that I think is wrong
everywhere else in the undo code:

+static void
+resource_cmd_calendar_free (PlannerCmd *cmd_base)
+{
+       ResourceCmdCalendar *cmd;
+
+       cmd = (ResourceCmdCalendar *) cmd_base;
+
+       g_free (cmd_base->label);
+       g_object_unref (cmd->resource);
+
+       if (cmd->old_calendar) {
+               g_object_unref (cmd->calendar);
+       }
+       if (cmd->old_calendar) {
+               g_object_unref (cmd->old_calendar);
+       }
+
+       g_free (cmd);
+}

You should only free stuff in the cmd struct, not the cmd_base one. The
undo manager should take care of the rest, including the cmd itself.

/Richard

-- 
Imendio HB, http://www.imendio.com/




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