Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Mark html_attributes as used #177

Merged
merged 1 commit into from

5 participants

@tomhughes

If the renderer is holding an html_attributes hash then it needs to mark it as used when the GC runs, or it may be freed.

@rmm5t

:+1: This seems to fix the issue that I reported in #176

@robin850 robin850 merged commit 1cac444 into from
@robin850
Collaborator

Thanks for your contribution @tomhughes! All tests are green on Travis.

@cpence

Are you guys planning on releasing a new version soon? This bug is eating a Middleman-based site of mine pretty badly. I'm using a git checkout through Bundler now, but I bet I'm not the only one to be bitten by it.

@mattr-
Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 ext/redcarpet/rc_render.c
View
8 ext/redcarpet/rc_render.c
@@ -321,11 +321,17 @@ static const char *rb_redcarpet_method_names[] = {
static const size_t rb_redcarpet_method_count = sizeof(rb_redcarpet_method_names)/sizeof(char *);
+static void rb_redcarpet_rbase_mark(struct rb_redcarpet_rndr *rndr)
+{
+ if (rndr->options.link_attributes)
+ rb_gc_mark(rndr->options.link_attributes);
+}
+
static VALUE rb_redcarpet_rbase_alloc(VALUE klass)
{
struct rb_redcarpet_rndr *rndr = ALLOC(struct rb_redcarpet_rndr);
memset(rndr, 0x0, sizeof(struct rb_redcarpet_rndr));
- return Data_Wrap_Struct(klass, NULL, NULL, rndr);
+ return Data_Wrap_Struct(klass, rb_redcarpet_rbase_mark, NULL, rndr);
}
static void rb_redcarpet__overload(VALUE self, VALUE base_class)
Something went wrong with that request. Please try again.