Browse Source

don't crash if svg file fails to load

master
parent
commit
445aff1608
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 11
      plugins/lfo/ui.c
  2. 19
      plugins/lfo/ui_theme.h
  3. 2
      subprojects/ztoolkit.wrap

11
plugins/lfo/ui.c

@ -2505,8 +2505,15 @@ create_ui ( @@ -2505,8 +2505,15 @@ create_ui (
WIDTH, HEIGHT);
/* init the theme */
zlfo_ui_theme_init (
&self->ui_theme, self->bundle_path);
int ret =
zlfo_ui_theme_init (
&self->ui_theme,
&self->common.pl_common.logger,
self->bundle_path);
if (ret)
{
return;
}
/** add each control */
add_bg_widget (self);

19
plugins/lfo/ui_theme.h

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Alexandros Theodotou <alex at zrythm dot org>
* Copyright (C) 2020-2021 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of ZLFO
*
@ -19,6 +19,8 @@ @@ -19,6 +19,8 @@
#include PLUGIN_CONFIG
#include "lv2/log/logger.h"
#include <ztoolkit/ztk.h>
#include <glib.h>
@ -102,11 +104,13 @@ typedef struct LfoUiTheme @@ -102,11 +104,13 @@ typedef struct LfoUiTheme
} LfoUiTheme;
static inline void
static inline int
zlfo_ui_theme_init (
LfoUiTheme * theme,
const char * bundle_path)
LfoUiTheme * theme,
LV2_Log_Logger * logger,
const char * bundle_path)
{
#define SET_COLOR(cname,_hex) \
ztk_color_parse_hex ( \
&theme->cname, _hex); \
@ -136,9 +140,10 @@ zlfo_ui_theme_init ( @@ -136,9 +140,10 @@ zlfo_ui_theme_init (
ztk_rsvg_load_svg (abs_path); \
if (!theme->name##_svg) \
{ \
ztk_error ( \
lv2_log_error ( \
logger, \
"Failed loading SVG: %s", abs_path); \
exit (1); \
return -1; \
}
LOAD_SVG (sine);
@ -170,6 +175,8 @@ zlfo_ui_theme_init ( @@ -170,6 +175,8 @@ zlfo_ui_theme_init (
LOAD_SVG (invert);
LOAD_SVG (shift);
LOAD_SVG (down_arrow);
return 0;
}
/**

2
subprojects/ztoolkit.wrap

@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
[wrap-git]
url = https://git.zrythm.org/git/ztoolkit
revision = 937d89387aa58120a369d19d606b3223aec5cdf8
revision = master

Loading…
Cancel
Save