Comments (2)
!nim c
type
O = ref object
s: string
cb: seq[proc()]
proc push1(o: O, i: int) =
let o = o
echo o.s, " ", i
o.cb.add(proc() = echo o.s, " ", i)
proc push2(o: O, i: int) =
let o = o
echo o.s, " ", i
proc p() = echo o.s, " ", i
o.cb.add(p)
let o = O(s: "hello", cb: @[])
o.push1(42) # This segfaults
o.push2(42) # This also segfaults
from nim.
By the way, workaround is simple here: just add
discard o
in the end of the proc and everything will work fine.
from nim.
Related Issues (20)
- `noinit` can cause arc to crash with ref objects HOT 2
- hello world Mummy web server crashes on devel HOT 17
- Sigsegv on std/tasks destructor HOT 2
- `=destroy` for non-var failed to compile when `nim doc` HOT 4
- regression from 2.0.4 to 2.0.6 cannot instantiate: 'SomeInteger' in return type HOT 1
- Deadloop in Windows, `os.sleep(-1)` HOT 5
- Deadloop in Windows, `os.sleep(-1)` HOT 1
- Inefficient codegen for field return HOT 2
- `setLen(0)` allocates memory causing performance regression HOT 3
- Generic sequence of proc type mismatch HOT 3
- `int64/int64` not compile for JS, but for C. HOT 4
- Regression: ambiguous identifier
- Regression from 1.6 to 2.0 using static parameter in return type with function taking typeclass HOT 3
- Can't create empty openArray with int8 HOT 8
- Warn on repeated non-trivial evaluations in templates
- Regression: compiler crash on static inference HOT 10
- in std/logging implement removeHandler
- `move(table)` does not move the table HOT 8
- Constructing case object with discriminator of field of other object fails with `the field(s) 'g' are in conflict with this value` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nim.