live-chart icon indicating copy to clipboard operation
live-chart copied to clipboard

Using LiveChart.ThresholdLine causes critical message for null access

Open ryonakano opened this issue 11 months ago • 0 comments

Summary

Using LiveChart.ThresholdLine in the code outputs the following critical message on terminal:

** (Application:111411): CRITICAL **: 21:09:11.664: gee_abstract_collection_foreach: assertion 'self != NULL' failed

Steps to Reproduce

  1. Save the following code with the name Application.vala:
Code Snippet
public class App : Gtk.Application {
    public App () {
        Object (
            application_id: "com.github.ryonakano.test",
            flags: ApplicationFlags.DEFAULT_FLAGS
        );
    }

    protected override void activate () {
        var window = new Gtk.ApplicationWindow(this);
        var chart = new LiveChart.Chart();

        var serie = new LiveChart.Serie("threshold", new LiveChart.ThresholdLine(200.0));
        chart.add_serie(serie);

        window.set_child(chart);
        window.present();
    }
}

public static int main (string[] args) {
    return new App ().run ();
}
  1. Compile the code with valac --pkg gtk4 --pkg livechart --pkg gee-0.8 --debug Application.vala
  2. Run the code with ./Application
  3. See the critical message

Expected Behavior

No critical message is shown.

GDB Stack Trace

[ryo@lb760m ~/work/tmp/test]$ G_DEBUG=fatal-criticals gdb ./Application
GNU gdb (Fedora Linux) 14.1-4.fc39
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./Application...
(gdb) r
Starting program: /home/ryo/work/tmp/test/Application

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffe84006c0 (LWP 113062)]
[New Thread 0x7fffe7a006c0 (LWP 113063)]
[New Thread 0x7fffe70006c0 (LWP 113064)]
[New Thread 0x7fffe66006c0 (LWP 113065)]
[Thread 0x7fffe66006c0 (LWP 113065) exited]
[New Thread 0x7fffe66006c0 (LWP 113066)]
[New Thread 0x7fffe4a006c0 (LWP 113067)]

** (Application:113057): CRITICAL **: 21:18:48.391: gee_abstract_collection_foreach: assertion 'self != NULL' failed

Thread 1 "Application" received signal SIGTRAP, Trace/breakpoint trap.
g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd6c0) at ../glib/gmessages.c:1423
1423            g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
(gdb) bt
#0  g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd6c0)
    at ../glib/gmessages.c:1423
#1  0x00007ffff7092463 in g_log
    (log_domain=log_domain@entry=0x0, log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7ffff70fa280 "%s: assertion '%s' failed") at ../glib/gmessages.c:1461
#2  0x00007ffff70936dd in g_return_if_fail_warning
    (log_domain=log_domain@entry=0x0, pretty_function=pretty_function@entry=0x7ffff7ef2340 <__func__.18.lto_priv.0> "gee_abstract_collection_foreach", expression=expression@entry=0x7ffff7ef0d49 "self != NULL") at ../glib/gmessages.c:2930
#3  0x00007ffff7e78401 in gee_abstract_collection_foreach (self=<optimized out>, f=<optimized out>, f_target=<optimized out>)
    at /usr/src/debug/libgee-0.20.6-3.fc39.x86_64/gee/abstractcollection.c:269
#4  0x00007ffff7f6133d in live_chart_series_register (self=0x5033e0, serie=0x580b80) at ../src/series.vala:19
#5  0x00007ffff7f439ff in live_chart_chart_add_serie (self=0x522a70, serie=0x580b80) at ../src/chart.vala:47
Python Exception <class 'gdb.error'>: value has been optimized out
(gdb)

Versions

  • live-chart: latest master branch (ecd23aa9ba110412cf433428e9e8680e4428e2eb)
  • OS: Fedora Linux 39 (Workstation Edition)
  • gtk4-devel: 4.12.5
  • libgee-devel: 0.20.6
  • Vala: 0.56.14

ryonakano avatar Mar 23 '24 12:03 ryonakano