Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
3eaaf39e
Commit
3eaaf39e
authored
9 years ago
by
murgatroid99
Browse files
Options
Downloads
Patches
Plain Diff
Properly mark proc used in call credentials for garbage collection
parent
52676ba0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ruby/ext/grpc/rb_call_credentials.c
+7
-1
7 additions, 1 deletion
src/ruby/ext/grpc/rb_call_credentials.c
with
7 additions
and
1 deletion
src/ruby/ext/grpc/rb_call_credentials.c
+
7
−
1
View file @
3eaaf39e
...
@@ -57,6 +57,10 @@ typedef struct grpc_rb_call_credentials {
...
@@ -57,6 +57,10 @@ typedef struct grpc_rb_call_credentials {
/* Holder of ruby objects involved in contructing the credentials */
/* Holder of ruby objects involved in contructing the credentials */
VALUE
mark
;
VALUE
mark
;
/* The proc called when getting the credentials. Same pointer as
wrapped->state */
VALUE
proc
;
/* The actual credentials */
/* The actual credentials */
grpc_call_credentials
*
wrapped
;
grpc_call_credentials
*
wrapped
;
}
grpc_rb_call_credentials
;
}
grpc_rb_call_credentials
;
...
@@ -164,11 +168,11 @@ static void grpc_rb_call_credentials_mark(void *p) {
...
@@ -164,11 +168,11 @@ static void grpc_rb_call_credentials_mark(void *p) {
return
;
return
;
}
}
wrapper
=
(
grpc_rb_call_credentials
*
)
p
;
wrapper
=
(
grpc_rb_call_credentials
*
)
p
;
/* If it's not already cleaned up, mark the mark object */
/* If it's not already cleaned up, mark the mark object */
if
(
wrapper
->
mark
!=
Qnil
)
{
if
(
wrapper
->
mark
!=
Qnil
)
{
rb_gc_mark
(
wrapper
->
mark
);
rb_gc_mark
(
wrapper
->
mark
);
}
}
rb_gc_mark
(
wrapper
->
proc
);
}
}
static
rb_data_type_t
grpc_rb_call_credentials_data_type
=
{
static
rb_data_type_t
grpc_rb_call_credentials_data_type
=
{
...
@@ -187,6 +191,7 @@ static rb_data_type_t grpc_rb_call_credentials_data_type = {
...
@@ -187,6 +191,7 @@ static rb_data_type_t grpc_rb_call_credentials_data_type = {
static
VALUE
grpc_rb_call_credentials_alloc
(
VALUE
cls
)
{
static
VALUE
grpc_rb_call_credentials_alloc
(
VALUE
cls
)
{
grpc_rb_call_credentials
*
wrapper
=
ALLOC
(
grpc_rb_call_credentials
);
grpc_rb_call_credentials
*
wrapper
=
ALLOC
(
grpc_rb_call_credentials
);
wrapper
->
wrapped
=
NULL
;
wrapper
->
wrapped
=
NULL
;
wrapper
->
proc
=
Qnil
;
wrapper
->
mark
=
Qnil
;
wrapper
->
mark
=
Qnil
;
return
TypedData_Wrap_Struct
(
cls
,
&
grpc_rb_call_credentials_data_type
,
wrapper
);
return
TypedData_Wrap_Struct
(
cls
,
&
grpc_rb_call_credentials_data_type
,
wrapper
);
}
}
...
@@ -267,6 +272,7 @@ static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) {
...
@@ -267,6 +272,7 @@ static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) {
return
Qnil
;
return
Qnil
;
}
}
wrapper
->
proc
=
proc
;
wrapper
->
wrapped
=
creds
;
wrapper
->
wrapped
=
creds
;
rb_ivar_set
(
self
,
id_callback
,
proc
);
rb_ivar_set
(
self
,
id_callback
,
proc
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment