fixes the crash on keyevent (#155)
This commit is contained in:
parent
5a65d378d2
commit
2541feebe7
@ -6,7 +6,7 @@
|
||||
|
||||
class QKeyEventWrap : public Napi::ObjectWrap<QKeyEventWrap>{
|
||||
private:
|
||||
std::unique_ptr<QKeyEvent> instance;
|
||||
QKeyEvent* instance;
|
||||
|
||||
public:
|
||||
static Napi::Object init(Napi::Env env, Napi::Object exports);
|
||||
|
||||
@ -19,7 +19,7 @@ Napi::Object QKeyEventWrap::init(Napi::Env env, Napi::Object exports) {
|
||||
}
|
||||
|
||||
QKeyEvent* QKeyEventWrap::getInternalInstance() {
|
||||
return this->instance.get();
|
||||
return this->instance;
|
||||
}
|
||||
|
||||
QKeyEventWrap::QKeyEventWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap<QKeyEventWrap>(info) {
|
||||
@ -27,7 +27,7 @@ QKeyEventWrap::QKeyEventWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap<Q
|
||||
Napi::HandleScope scope(env);
|
||||
if(info.Length() == 1) {
|
||||
Napi::External<QKeyEvent> eventObject = info[0].As<Napi::External<QKeyEvent>>();
|
||||
this->instance = std::unique_ptr<QKeyEvent>(eventObject.Data());
|
||||
this->instance = static_cast<QKeyEvent*>(eventObject.Data());
|
||||
} else {
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user