Advertisement
Bellaz89

Untitled

Jun 16th, 2020
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1.     virtual void SetPrivateData(JSContext* cx) {                              
  2.           ENSURE(m_JSObject.initialized());                                      
  3.           JS::RootedObject ptrObj(cx, JS_NewObject(cx, &IGUIObject::store_class));
  4.           JS_SetPrivate(ptrObj, (void*) this);                                  
  5.           JS::RootedValue ptrVal(cx);                                            
  6.           ptrVal.setObject(*ptrObj);                                            
  7.           /** I'm not entirely sure this static cast is needed but it seems conceptually correct, and safer */
  8.           js::SetProxyReservedSlot(m_JSObject.get(), 0, ptrVal);                
  9.       };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement