sejerpz / vtg

Automatically exported from code.google.com/p/vtg
0 stars 0 forks source link

Crash when using generics #145

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I was editing this program from the vala ML

I got a crash:

**
ERROR:arraylist.c:321:vala_array_list_real_get: assertion failed: ((index >= 0) 
&& (index < self->priv->_size))

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x952fbb70 (LWP 2869)]
0xb7fe2424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fe2424 in __kernel_vsyscall ()
#1  0xb758f751 in *__GI_raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xb7592b82 in *__GI_abort () at abort.c:92
#3  0xb788a31f in IA__g_assertion_message (domain=0x0, 
    file=0xb25dce45 "arraylist.c", line=321, 
    func=0xb25dcfaa "vala_array_list_real_get", 
    message=0x9916a780 "assertion failed: ((index >= 0) && (index < self->priv->_size))")
    at /build/buildd-glib2.0_2.24.1-1-i386-84Pp4V/glib2.0-2.24.1/glib/gtestutils.c:1318
#4  0xb788a97d in IA__g_assertion_message_expr (domain=0x0, 
    file=0xb25dce45 "arraylist.c", line=321, 
    func=0xb25dcfaa "vala_array_list_real_get", 
    expr=0xb25dcda4 "(index >= 0) && (index < self->priv->_size)")
    at /build/buildd-glib2.0_2.24.1-1-i386-84Pp4V/glib2.0-2.24.1/glib/gtestutils.c:1329
#5  0xb2588b7a in vala_array_list_real_get (base=0x980482e8, index=1)
    at arraylist.c:321
#6  0xb2589a4a in vala_list_get (self=0x980482e8, index=1) at list.c:131
#7  0xb261c91a in afrodite_symbol_specialize_generic_symbol (self=0x9b9b62a0, 
    types=0xaa8a1d98) at symbol.vala:830
#8  0xb26208d7 in afrodite_symbol_resolver_specialize_generic_symbol (
---Type <return> to continue, or q <return> to quit---
    self=<value optimized out>, type=<value optimized out>, symbol=0x99994c98)
    at symbolresolver.vala:190
#9  0xb2620a2c in afrodite_symbol_resolver_specialize_generic_symbol (
    self=<value optimized out>, type=<value optimized out>, symbol=0x9a002540)
    at symbolresolver.vala:206
#10 0xb26200f0 in afrodite_symbol_resolver_resolve_type (
    self=<value optimized out>, symbol=<value optimized out>, type=0x9966c958)
    at symbolresolver.vala:176
#11 0xb26202d1 in afrodite_symbol_resolver_visit_symbol (
    self=<value optimized out>, symbol=<value optimized out>)
    at symbolresolver.vala:248
#12 0xb2620720 in afrodite_symbol_resolver_visit_symbols (
    self=<value optimized out>, symbols=<value optimized out>)
    at symbolresolver.vala:276
#13 0xb2620720 in afrodite_symbol_resolver_visit_symbols (
    self=<value optimized out>, symbols=<value optimized out>)
    at symbolresolver.vala:276
#14 0xb2620720 in afrodite_symbol_resolver_visit_symbols (
    self=<value optimized out>, symbols=<value optimized out>)
    at symbolresolver.vala:276
#15 0xb262aad3 in afrodite_completion_engine_parse_sources (self=0xc0c1640)
    at completionengine.vala:326
#16 _afrodite_completion_engine_parse_sources_gthread_func (self=0xc0c1640)
---Type <return> to continue, or q <return> to quit---
    at completionengine.c:783
#17 0xb788e69f in g_thread_create_proxy (data=0xb448da8)
    at /build/buildd-glib2.0_2.24.1-1-i386-84Pp4V/glib2.0-2.24.1/glib/gthread.c:1893
#18 0xb76b2955 in start_thread (arg=0x952fbb70) at pthread_create.c:300
#19 0xb763110e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
(gdb) c

Original issue reported on code.google.com by seje...@gmail.com on 20 Aug 2010 at 12:03

GoogleCodeExporter commented 9 years ago
The vala source:

using Gee;

public interface Enumerable<G> : Iterable<G> {
  public delegate O DFunc<I, O>(I elem);

  public void map(DFunc fn, Gee.List acc) {
    foreach (G i in this) {
      acc.add(fn(i));
    }
  }
}

public class EnumerableList<G> : Gee.ArrayList<G>, Enumerable<G> {
}

public string f(int i) {
  return "%d".printf(i);
}

public static int main(string[] args) {
  var a = new EnumerableList<int> ();
  a.add(1);
  a.add(2);
  a.add(3);
  var b = new Gee.ArrayList<string> ();
  a.map((Enumerable.DFunc<int, string>) f , b);
  foreach (string i in b) {
    stdout.printf("-- %s --\n", i);
  }

  return 0;
}

Original comment by seje...@gmail.com on 20 Aug 2010 at 12:03

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r747.

Original comment by seje...@gmail.com on 20 Aug 2010 at 12:18

GoogleCodeExporter commented 9 years ago

Original comment by seje...@gmail.com on 24 Aug 2010 at 6:23