Skip to content

Commit ac27216

Browse files
authored
Move freeing printer objects from cpdbPrinterCallback() to cpdbOnPrinterRemoved() for API consistence (#83)
Fixes #79 Straightens the logic of the API. The object is created in cpdbOnPrinterAdded() so it shouls be freed in cpdbOnPrinterRemoved() and not in cpdbPrinterCallback(). NOTE: This can require changes in frontends.
1 parent 1e4af28 commit ac27216

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cpdb/cpdb-frontend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ void cpdbPrinterCallback(cpdb_frontend_obj_t *f, cpdb_printer_obj_t *p, cpdb_pri
8383

8484
case CPDB_CHANGE_PRINTER_REMOVED:
8585
g_message("Removed printer %s : %s!\n", p->name, p->backend_name);
86-
cpdbDeletePrinterObj(p);
8786
break;
8887

8988
case CPDB_CHANGE_PRINTER_STATE_CHANGED:
@@ -129,6 +128,7 @@ void cpdbOnPrinterRemoved(GDBusConnection *connection,
129128
g_variant_get(parameters, "(ss)", &printer_id, &backend_name);
130129
cpdb_printer_obj_t *p = cpdbRemovePrinter(f, printer_id, backend_name);
131130
f->printer_cb(f, p, CPDB_CHANGE_PRINTER_REMOVED);
131+
cpdbDeletePrinterObj(p);
132132
}
133133

134134
void cpdbOnPrinterStateChanged(GDBusConnection *connection,

0 commit comments

Comments
 (0)