crash - Weird Qt behavior crashing my application -
normally when have problem in qt, due me not understanding problem illogical.
i have function handle hotkey's event:
bool mainwidget::nativeevent(const qbytearray& eventtype, void* message, long* result) { msg* msg = reinterpret_cast<msg*>(message); if (msg->message == wm_hotkey) { qdebug() << "it works"; // if remove line, app crashes. togglevisibility(false); } }
it works if remove qdebug() line, app crashes starts running. nothing gets displayed. code in constructor runs seems crashes gets function.
in constructor of main widget, have line register hotkey:
if (!registerhotkey(hwnd(this->winid()), 1, mod_control | mod_shift | 0x4000, 0x41)) qdebug() << ("hotkey failed");
adding other line instead of qdebug doesn't make difference. (e.g delete msg). removing line 'togglevisility' doesn't make difference rules out function.
if move qdebug line before if statement not crash application. seem qdebug line required somehow doesn't make sense @ all.
if can make sense of this, please let me know. rather not leave qdebug lines in application.
i found out how stop application crashing , removing qdebug. qt nativeevent
event has return bool. adding line return null
stop crashing.
however cannot explain why qdebug prevented crashing before.
Comments
Post a Comment