Skip to content

Commit 9d89129

Browse files
committed
fix some memleaks
1 parent 3488d15 commit 9d89129

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,6 @@ On success, merge to master.
230230

231231
## TODO
232232

233-
- paste kills it
234-
235-
- copy then paste into gimp doesn't seem to work
236-
237-
- test drag/drop too
238-
239233
- get `object_unref: assertion 'G_IS_OBJECT (object)' failed` during free of
240234
stack ... seems to be a harmless minor glib bug with `g_clear_object()`
241235
failing with a crit for a null value
@@ -244,7 +238,8 @@ On success, merge to master.
244238

245239
- load cancel does not work
246240

247-
- duplicate should copy all view params?
241+
- duplicate should copy more view params? slider settings? scale and
242+
position?
248243

249244
- check mem use, esp with three large images loaded
250245

src/gtkutil.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ change_state(GtkWidget *widget, const char *name, GVariant *state)
127127
g_action_change_state(action, state);
128128
}
129129

130+
void
131+
set_state(GtkWidget *to, GSettings *settings, const char *name)
132+
{
133+
g_autoptr(GVariant) var = g_settings_get_value(settings, name);
134+
135+
change_state(to, name, var);
136+
}
137+
130138
GVariant *
131139
get_state(GtkWidget *widget, const char *name)
132140
{

src/gtkutil.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ void copy_adj(GtkAdjustment *to, GtkAdjustment *from);
1010
void change_state(GtkWidget *widget, const char *name, GVariant *state);
1111
GVariant *get_state(GtkWidget *widget, const char *name);
1212
void copy_state(GtkWidget *to, GtkWidget *from, const char *name);
13+
void set_state(GtkWidget *to, GSettings *settings, const char *name);
1314

1415
void process_events(void);
1516

src/imagewindow.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,8 @@ image_window_imageui_set_visible(ImageWindow *win,
634634

635635
/* Enable the control settings, if the displaycontrolbar is on.
636636
*/
637-
GVariant *control = g_settings_get_value(win->settings, "control");
637+
g_autoptr(GVariant) control =
638+
g_settings_get_value(win->settings, "control");
638639
g_object_set(new_tile_source,
639640
"active", g_variant_get_boolean(control),
640641
"visible", TRUE,
@@ -1562,17 +1563,12 @@ image_window_init(ImageWindow *win)
15621563
* instead.
15631564
*/
15641565

1565-
/* Initialise from settings.
1566+
/* Menu state from settings.
15661567
*/
1567-
change_state(GTK_WIDGET(win), "properties",
1568-
g_settings_get_value(win->settings, "properties"));
1569-
1570-
/* Initial menu state from settings.
1571-
*/
1572-
change_state(GTK_WIDGET(win), "control",
1573-
g_settings_get_value(win->settings, "control"));
1574-
change_state(GTK_WIDGET(win), "info",
1575-
g_settings_get_value(win->settings, "info"));
1568+
set_state(GTK_WIDGET(win), win->settings, "properties");
1569+
set_state(GTK_WIDGET(win), win->settings, "control");
1570+
set_state(GTK_WIDGET(win), win->settings, "info");
1571+
set_state(GTK_WIDGET(win), win->settings, "background");
15761572

15771573
// some kind of gtk bug? hexpand on properties can't be set from .ui or in
15781574
// properties.c, but must be set after adding to a parent

0 commit comments

Comments
 (0)