File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -563,6 +563,7 @@ SEXP rnng_monitor_create(SEXP socket, SEXP cv) {
563563 monitor -> cv = (nano_cv * ) NANO_PTR (cv );
564564 nng_socket * sock = (nng_socket * ) NANO_PTR (socket );
565565
566+ SEXP xptr ;
566567 int xc ;
567568
568569 if ((xc = nng_pipe_notify (* sock , NNG_PIPE_EV_ADD_POST , pipe_cb_monitor , monitor )))
@@ -571,10 +572,11 @@ SEXP rnng_monitor_create(SEXP socket, SEXP cv) {
571572 if ((xc = nng_pipe_notify (* sock , NNG_PIPE_EV_REM_POST , pipe_cb_monitor , monitor )))
572573 ERROR_OUT (xc );
573574
574- SEXP xptr = R_MakeExternalPtr (monitor , nano_MonitorSymbol , R_NilValue );
575+ PROTECT ( xptr = R_MakeExternalPtr (monitor , nano_MonitorSymbol , R_NilValue ) );
575576 R_RegisterCFinalizerEx (xptr , monitor_finalizer , TRUE);
576577 NANO_CLASS2 (xptr , "nanoMonitor" , "nano" );
577578 Rf_setAttrib (xptr , nano_SocketSymbol , Rf_ScalarInteger (nng_socket_id (* sock )));
579+ UNPROTECT (1 );
578580
579581 return xptr ;
580582
You can’t perform that action at this time.
0 commit comments