mirror of
https://github.com/profanity-im/profanity.git
synced 2025-07-26 12:14:28 -04:00
commit
4e06fa4187
1
.gitignore
vendored
1
.gitignore
vendored
@ -73,6 +73,7 @@ toc_fragment.html
|
||||
|
||||
# valgrind files
|
||||
valgrind.out
|
||||
my-prof.supp
|
||||
|
||||
# Generate docs
|
||||
apidocs/python/_build/
|
||||
|
@ -110,6 +110,12 @@ We provide a suppressions file `prof.supp`. It is a combination of the suppressi
|
||||
|
||||
`G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --track-origins=yes --leak-check=full --leak-resolution=high --num-callers=30 --show-leak-kinds=definite --log-file=profval --suppressions=prof.supp ./profanity`
|
||||
|
||||
There's also the option to create a "personalized" suppression file with the up-to-date glib2 and python suppressions.
|
||||
|
||||
`make my-prof.supp`
|
||||
|
||||
After executing this, you can replace the `--suppressions=prof.supp` argument in the above call, by `--suppressions=my-prof.supp`.
|
||||
|
||||
### clang
|
||||
|
||||
Running the clang static code analyzer helps improving the quality too.
|
||||
|
@ -343,6 +343,14 @@ clean-local:
|
||||
rm -f $(git_include) $(git_include).in
|
||||
endif
|
||||
|
||||
.PHONY: my-prof.supp
|
||||
my-prof.supp:
|
||||
@sed '/^# AUTO-GENERATED START/q' prof.supp > $@
|
||||
@cat /usr/share/glib-2.0/valgrind/glib.supp >> $@
|
||||
@wget -O- https://raw.githubusercontent.com/python/cpython/refs/tags/v`python3 --version | cut -d' ' -f2`/Misc/valgrind-python.supp >> $@
|
||||
@test -z "@GTK_VERSION@" || wget -O- https://raw.githubusercontent.com/GNOME/gtk/refs/tags/@GTK_VERSION@/gtk.supp >> $@
|
||||
@test -z "@GTK_VERSION@" || cat /usr/share/gtk-3.0/valgrind/gtk.supp >> $@
|
||||
|
||||
check-unit: tests/unittests/unittests
|
||||
tests/unittests/unittests
|
||||
|
||||
|
1
autogen.sh
Symbolic link
1
autogen.sh
Symbolic link
@ -0,0 +1 @@
|
||||
bootstrap.sh
|
@ -237,7 +237,8 @@ AS_IF([test "x$PLATFORM" = xosx],
|
||||
dnl feature: icons-and-clipboard
|
||||
AS_IF([test "x$enable_icons_and_clipboard" != xno],
|
||||
[PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.24.0],
|
||||
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])],
|
||||
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])
|
||||
GTK_VERSION=`pkg-config --modversion gtk+-3.0`],
|
||||
[AS_IF([test "x$enable_icons_and_clipboard" = xyes],
|
||||
[PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.24.10],
|
||||
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])],
|
||||
@ -389,6 +390,7 @@ LIBS="$glib_LIBS $gio_LIBS $PTHREAD_LIBS $curl_LIBS $libnotify_LIBS $python_LIBS
|
||||
AC_SUBST(AM_LDFLAGS)
|
||||
AC_SUBST(AM_CFLAGS)
|
||||
AC_SUBST(AM_CPPFLAGS)
|
||||
AC_SUBST(GTK_VERSION)
|
||||
|
||||
## Output
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
@ -397,6 +399,7 @@ AC_OUTPUT
|
||||
AC_MSG_NOTICE([Summary of build options:
|
||||
PLATFORM : $target_os
|
||||
PACKAGE_STATUS : $PACKAGE_STATUS
|
||||
GTK_VERSION : $GTK_VERSION
|
||||
LIBS : $LIBS
|
||||
Install themes : $THEMES_INSTALL
|
||||
Themes path : $THEMES_PATH
|
||||
|
61
prof.supp
61
prof.supp
@ -23,6 +23,13 @@
|
||||
fun:gtk_init_check
|
||||
...
|
||||
}
|
||||
{
|
||||
gtk_module_init
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gtk_module_init
|
||||
...
|
||||
}
|
||||
|
||||
# glib
|
||||
|
||||
@ -43,7 +50,61 @@
|
||||
fun:omemo_crypto_init
|
||||
...
|
||||
}
|
||||
{
|
||||
gcry_mpi_scan
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gcry_mpi_scan
|
||||
...
|
||||
}
|
||||
|
||||
# libreadline related
|
||||
{
|
||||
leak readline
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:readline
|
||||
}
|
||||
{
|
||||
leak add_history
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:add_history
|
||||
}
|
||||
{
|
||||
leak rl_make_bare_keymap
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:rl_make_bare_keymap
|
||||
}
|
||||
{
|
||||
leak rl_add_funmap_entry
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:rl_add_funmap_entry
|
||||
}
|
||||
{
|
||||
leak rl_initialize
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:rl_initialize
|
||||
}
|
||||
|
||||
# Python related
|
||||
{
|
||||
Handle PyMalloc confusing valgrind (possibly leaked)
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_PyObject_GC_New
|
||||
}
|
||||
{
|
||||
Handle PyMalloc confusing valgrind (possibly leaked)
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:PyType_Ready
|
||||
}
|
||||
|
||||
# AUTO-GENERATED START
|
||||
|
||||
# GLib Valgrind suppressions file
|
||||
#
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2882,6 +2882,7 @@ void
|
||||
cmd_uninit(void)
|
||||
{
|
||||
cmd_ac_uninit();
|
||||
g_hash_table_destroy(commands);
|
||||
g_hash_table_destroy(search_index);
|
||||
}
|
||||
|
||||
|
@ -1328,7 +1328,8 @@ gboolean
|
||||
cmd_quit(ProfWin* window, const char* const command, gchar** args)
|
||||
{
|
||||
log_info("Profanity is shutting down…");
|
||||
exit(0);
|
||||
if (prof_set_quit())
|
||||
exit(0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -430,13 +430,18 @@ out:
|
||||
}
|
||||
|
||||
void
|
||||
color_pair_cache_reset(void)
|
||||
color_pair_cache_free(void)
|
||||
{
|
||||
if (cache.pairs) {
|
||||
free(cache.pairs);
|
||||
memset(&cache, 0, sizeof(cache));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
color_pair_cache_reset(void)
|
||||
{
|
||||
color_pair_cache_free();
|
||||
/*
|
||||
* COLOR_PAIRS is actually not a macro and is thus not a
|
||||
* compile-time constant
|
||||
|
@ -61,5 +61,7 @@ int color_pair_cache_hash_str(const char* str, color_profile profile);
|
||||
int color_pair_cache_get(const char* pair_name);
|
||||
/* clear cache */
|
||||
void color_pair_cache_reset(void);
|
||||
/* free cache */
|
||||
void color_pair_cache_free(void);
|
||||
|
||||
#endif
|
||||
|
@ -251,6 +251,7 @@ theme_list(void)
|
||||
void
|
||||
theme_close(void)
|
||||
{
|
||||
color_pair_cache_free();
|
||||
if (theme) {
|
||||
g_key_file_free(theme);
|
||||
theme = NULL;
|
||||
|
@ -194,6 +194,7 @@ otr_shutdown(void)
|
||||
free(jid);
|
||||
jid = NULL;
|
||||
}
|
||||
otrlib_shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -44,6 +44,7 @@ void otrlib_init_ops(OtrlMessageAppOps* ops);
|
||||
|
||||
void otrlib_init_timer(void);
|
||||
void otrlib_poll(void);
|
||||
void otrlib_shutdown(void);
|
||||
|
||||
ConnContext* otrlib_context_find(OtrlUserState user_state, const char* const recipient, char* jid);
|
||||
|
||||
|
@ -62,6 +62,12 @@ otrlib_init_timer(void)
|
||||
current_interval = otrl_message_poll_get_default_interval(user_state);
|
||||
}
|
||||
|
||||
void
|
||||
otrlib_shutdown(void)
|
||||
{
|
||||
g_timer_destroy(timer);
|
||||
}
|
||||
|
||||
void
|
||||
otrlib_poll(void)
|
||||
{
|
||||
|
@ -1609,7 +1609,9 @@ python_init_prof(void)
|
||||
#ifdef PY_IS_PYTHON3
|
||||
PyImport_AppendInittab("prof", python_api_init);
|
||||
Py_Initialize();
|
||||
#if PY_VERSION_HEX < 0x03070000
|
||||
PyEval_InitThreads();
|
||||
#endif
|
||||
#else
|
||||
Py_Initialize();
|
||||
PyEval_InitThreads();
|
||||
|
@ -134,10 +134,12 @@ prof_run(char* log_level, char* account_name, char* config_file, char* log_file,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
prof_set_quit(void)
|
||||
{
|
||||
gboolean ret = force_quit;
|
||||
force_quit = TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
void prof_run(char* log_level, char* account_name, char* config_file, char* log_file, char* theme_name);
|
||||
void prof_set_quit(void);
|
||||
gboolean prof_set_quit(void);
|
||||
|
||||
extern pthread_mutex_t lock;
|
||||
|
||||
|
@ -213,12 +213,12 @@ _create_entry(const char* show_char, int pad_indent, GDateTime* time, int flags,
|
||||
static void
|
||||
_free_entry(ProfBuffEntry* entry)
|
||||
{
|
||||
free(entry->show_char);
|
||||
free(entry->message);
|
||||
free(entry->display_from);
|
||||
free(entry->from_jid);
|
||||
free(entry->id);
|
||||
free(entry->receipt);
|
||||
free(entry->message);
|
||||
free(entry->from_jid);
|
||||
free(entry->display_from);
|
||||
g_date_time_unref(entry->time);
|
||||
free(entry->show_char);
|
||||
free(entry->receipt);
|
||||
free(entry);
|
||||
}
|
||||
|
@ -81,6 +81,7 @@
|
||||
static int inp_size;
|
||||
static gboolean perform_resize = FALSE;
|
||||
static GTimer* ui_idle_time;
|
||||
static WINDOW* main_scr;
|
||||
|
||||
#ifdef HAVE_LIBXSS
|
||||
static Display* display;
|
||||
@ -92,7 +93,7 @@ void
|
||||
ui_init(void)
|
||||
{
|
||||
log_info("Initialising UI");
|
||||
initscr();
|
||||
main_scr = initscr();
|
||||
nonl();
|
||||
cbreak();
|
||||
noecho();
|
||||
@ -182,12 +183,16 @@ ui_reset_idle_time(void)
|
||||
void
|
||||
ui_close(void)
|
||||
{
|
||||
g_timer_destroy(ui_idle_time);
|
||||
endwin();
|
||||
notifier_uninit();
|
||||
cons_clear_alerts();
|
||||
wins_destroy();
|
||||
inp_close();
|
||||
status_bar_close();
|
||||
endwin();
|
||||
free_title_bar();
|
||||
delwin(main_scr);
|
||||
delscreen(set_term(NULL));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -273,6 +273,7 @@ void
|
||||
inp_close(void)
|
||||
{
|
||||
rl_callback_handler_remove();
|
||||
delwin(inp_win);
|
||||
fclose(discard);
|
||||
}
|
||||
|
||||
|
@ -119,9 +119,7 @@ status_bar_init(void)
|
||||
void
|
||||
status_bar_close(void)
|
||||
{
|
||||
if (tz) {
|
||||
g_time_zone_unref(tz);
|
||||
}
|
||||
delwin(statusbar_win);
|
||||
if (statusbar) {
|
||||
if (statusbar->time) {
|
||||
g_free(statusbar->time);
|
||||
@ -137,6 +135,9 @@ status_bar_close(void)
|
||||
}
|
||||
free(statusbar);
|
||||
}
|
||||
if (tz) {
|
||||
g_time_zone_unref(tz);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -85,6 +85,12 @@ create_title_bar(void)
|
||||
inp_put_back();
|
||||
}
|
||||
|
||||
void
|
||||
free_title_bar(void)
|
||||
{
|
||||
delwin(win);
|
||||
}
|
||||
|
||||
void
|
||||
title_bar_update_virtual(void)
|
||||
{
|
||||
|
@ -37,6 +37,7 @@
|
||||
#define UI_TITLEBAR_H
|
||||
|
||||
void create_title_bar(void);
|
||||
void free_title_bar(void);
|
||||
void title_bar_update_virtual(void);
|
||||
void title_bar_resize(void);
|
||||
void title_bar_console(void);
|
||||
|
@ -187,6 +187,7 @@ tray_shutdown(void)
|
||||
}
|
||||
g_string_free(icon_filename, TRUE);
|
||||
g_string_free(icon_msg_filename, TRUE);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -61,11 +61,11 @@
|
||||
#include "ui/screen.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "xmpp/roster_list.h"
|
||||
#include "xmpp/connection.h"
|
||||
#include "database.h"
|
||||
|
||||
#define CONS_WIN_TITLE "Profanity. Type /help for help information."
|
||||
#define XML_WIN_TITLE "XML Console"
|
||||
static const int PAD_SIZE = 100;
|
||||
static const char* LOADING_MESSAGE = "Loading older messages…";
|
||||
static const char* CONS_WIN_TITLE = "Profanity. Type /help for help information.";
|
||||
static const char* XML_WIN_TITLE = "XML Console";
|
||||
|
||||
#define CEILING(X) (X - (int)(X) > 0 ? (int)(X + 1) : (int)(X))
|
||||
|
||||
|
@ -56,9 +56,6 @@
|
||||
#include "xmpp/contact.h"
|
||||
#include "xmpp/muc.h"
|
||||
|
||||
#define PAD_SIZE 10000
|
||||
#define LOADING_MESSAGE "Loading older messages…"
|
||||
|
||||
void win_move_to_end(ProfWin* window);
|
||||
void win_show_status_string(ProfWin* window, const char* const from,
|
||||
const char* const show, const char* const status,
|
||||
|
@ -167,6 +167,8 @@ void
|
||||
connection_shutdown(void)
|
||||
{
|
||||
connection_clear_data();
|
||||
g_hash_table_destroy(conn.requested_features);
|
||||
g_hash_table_destroy(conn.available_resources);
|
||||
if (conn.xmpp_conn) {
|
||||
xmpp_conn_release(conn.xmpp_conn);
|
||||
conn.xmpp_conn = NULL;
|
||||
|
@ -83,6 +83,12 @@ presence_sub_requests_init(void)
|
||||
sub_requests_ac = autocomplete_new();
|
||||
}
|
||||
|
||||
void
|
||||
presence_sub_requests_destroy(void)
|
||||
{
|
||||
autocomplete_free(sub_requests_ac);
|
||||
}
|
||||
|
||||
void
|
||||
presence_handlers_init(void)
|
||||
{
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
void presence_handlers_init(void);
|
||||
void presence_sub_requests_init(void);
|
||||
void presence_sub_requests_destroy(void);
|
||||
void presence_clear_sub_requests(void);
|
||||
|
||||
#endif
|
||||
|
@ -233,7 +233,7 @@ session_shutdown(void)
|
||||
_session_free_internals();
|
||||
|
||||
chat_sessions_clear();
|
||||
presence_clear_sub_requests();
|
||||
presence_sub_requests_destroy();
|
||||
|
||||
connection_shutdown();
|
||||
if (saved_status) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user