pidgin/pidginstatusprimitivechooser.h

Thu, 02 Mar 2023 23:58:21 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Thu, 02 Mar 2023 23:58:21 -0600
changeset 42109
27c84f0b3258
parent 41925
103594fbcf6b
child 42189
4784cd60a1f8
permissions
-rw-r--r--

Fix leaks in debug window

Fixes two leaks from the debug window:
```
22 bytes in 1 blocks are definitely lost in loss record 7,038 of 41,972
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x4980168: g_malloc (gmem.c:130)
by 0x4995602: g_strdup (gstrfuncs.c:363)
by 0x4CFB782: purple_prefs_connect_callback (prefs.c:1301)
by 0x48AA524: pidgin_debug_init (pidgindebug.c:918)
by 0x48B8F9E: pidgin_ui_start (pidginui.c:146)
by 0x4D37B01: purple_ui_start (purpleui.c:397)
by 0x4CE3BA6: purple_core_init (core.c:211)
by 0x48A384F: pidgin_application_startup (pidginapplication.c:820)
by 0x4DD3553: UnknownInlinedFun (gclosure.c:895)
by 0x4DD3553: g_signal_emit_valist (gsignal.c:3456)
by 0x4DD3632: g_signal_emit (gsignal.c:3606)
by 0x5815B82: g_application_register (gapplication.c:2211)
```
and
```
32 bytes in 1 blocks are definitely lost in loss record 15,308 of 41,972
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x4980168: g_malloc (gmem.c:130)
by 0x4997AB5: g_slice_alloc (gslice.c:1074)
by 0x495E14C: UnknownInlinedFun (gdatetime.c:678)
by 0x495E14C: g_date_time_from_instant (gdatetime.c:774)
by 0x495F4E9: g_date_time_new_now_local (gdatetime.c:989)
by 0x48A82F9: save_response_cb (pidgindebug.c:136)
by 0x4DB4375: g_cclosure_marshal_VOID__INTv (gmarshal.c:596)
by 0x4DD3553: UnknownInlinedFun (gclosure.c:895)
by 0x4DD3553: g_signal_emit_valist (gsignal.c:3456)
by 0x4DD3632: g_signal_emit (gsignal.c:3606)
by 0x4DB5FBF: g_closure_invoke (gclosure.c:832)
by 0x4DE3D85: signal_emit_unlocked_R.isra.0 (gsignal.c:3796)
by 0x4DD3419: g_signal_emit_valist (gsignal.c:3549)
```

Testing Done:
Ran in valgrind, saved the debug logs to a file, and the above leaks were gone.

Reviewed at https://reviews.imfreedom.org/r/2304/

41268
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
41276
03f98ece6b26 Fix a ton of missing and incorrect global header guards
Gary Kramlich <grim@reaperworld.com>
parents: 41269
diff changeset
23 #if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
03f98ece6b26 Fix a ton of missing and incorrect global header guards
Gary Kramlich <grim@reaperworld.com>
parents: 41269
diff changeset
24 # error "only <pidgin.h> may be included directly"
03f98ece6b26 Fix a ton of missing and incorrect global header guards
Gary Kramlich <grim@reaperworld.com>
parents: 41269
diff changeset
25 #endif
03f98ece6b26 Fix a ton of missing and incorrect global header guards
Gary Kramlich <grim@reaperworld.com>
parents: 41269
diff changeset
26
41268
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #ifndef PIDGIN_STATUS_PRIMITIVE_CHOOSER_H
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 #define PIDGIN_STATUS_PRIMITIVE_CHOOSER_H
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 #include <gtk/gtk.h>
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31
41925
103594fbcf6b Convert PidginStatusPrimitiveChooser to a GtkDropDown
Gary Kramlich <grim@reaperworld.com>
parents: 41356
diff changeset
32 #include <adwaita.h>
103594fbcf6b Convert PidginStatusPrimitiveChooser to a GtkDropDown
Gary Kramlich <grim@reaperworld.com>
parents: 41356
diff changeset
33
41268
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 #include <purple.h>
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 G_BEGIN_DECLS
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 /**
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 * PidginStatusPrimitiveChooser:
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 *
41269
c82a353713f6 Fix some doc issues that were missed in the StatusPrimitiveChooser review request
Gary Kramlich <grim@reaperworld.com>
parents: 41268
diff changeset
41 * A [class@Gtk.ComboBox] for presenting [enum@Purple.StatusPrimitive]'s to a
41268
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 * user.
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 *
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 * Since: 3.0.0
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 */
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 #define PIDGIN_TYPE_STATUS_PRIMITIVE_CHOOSER (pidgin_status_primitive_chooser_get_type())
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 G_DECLARE_FINAL_TYPE(PidginStatusPrimitiveChooser,
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 pidgin_status_primitive_chooser, PIDGIN,
41925
103594fbcf6b Convert PidginStatusPrimitiveChooser to a GtkDropDown
Gary Kramlich <grim@reaperworld.com>
parents: 41356
diff changeset
50 STATUS_PRIMITIVE_CHOOSER, AdwBin)
41268
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 /**
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 * pidgin_status_primitive_chooser_new:
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 *
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 * Creates a new combo box that contains all of the available status
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 * primitives in purple.
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 *
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 * Returns: (transfer full): The new combo box.
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 *
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 * Since: 3.0.0
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 */
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 GtkWidget *pidgin_status_primitive_chooser_new(void);
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
41356
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
64 /**
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
65 * pidgin_status_primitive_chooser_get_selected:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
66 * @chooser: The instance.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
67 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
68 * Gets the [enum@Purple.StatusPrimitive] that is selected.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
69 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
70 * Returns: The selected primitive status.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
71 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
72 * Since: 3.0.0
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
73 */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
74 PurpleStatusPrimitive pidgin_status_primitive_chooser_get_selected(PidginStatusPrimitiveChooser *chooser);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
75
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
76 /**
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
77 * pidgin_status_primitive_chooser_set_selected:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
78 * @chooser: The instance.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
79 * @primitive: The [enum@Purple.StatusPrimitive] to set.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
80 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
81 * Sets @primitive as the active item.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
82 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
83 * Since: 3.0.0
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
84 */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
85 void pidgin_status_primitive_chooser_set_selected(PidginStatusPrimitiveChooser *chooser, PurpleStatusPrimitive primitive);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents: 41276
diff changeset
86
41268
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 G_END_DECLS
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88
4adf517478fc Create new widget and store for choosing status primitives
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 #endif /* PIDGIN_STATUS_PRIMITIVE_CHOOSER_H */

mercurial