debug assert in walletcontroller.cpp in func getOrCreateWallet, if thread is not gui #18835

issue tarboss opened this issue on April 30, 2020
  1. tarboss commented at 5:59 PM on April 30, 2020: none

    hello guys,

    code to inspect: wallet_model->moveToThread(thread()); wallet_model->setParent(this)

    fires on my machine under visual studio 2017, Qt 5.9.7 a debug assert, if thread is from QTimer::singleShot. if u roll back the code with the slot implementation, then u have no problems. On release it works, but u have a bad feeling.

    here is the orginal error msg: GUI: ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 0x0x351f1ec0. Receiver '' (of type 'WalletController') was created in thread 0x0x21a27c0", N:\Qt\Qtv5.9.7_src\qtbase\src\corelib\kernel\qcoreapplication.cpp, line 563

  2. MarcoFalke added the label GUI on Apr 30, 2020
  3. MarcoFalke added the label Windows on Apr 30, 2020
  4. promag commented at 6:07 PM on April 30, 2020: member

    Do you have a stack trace?

    if u roll back the code with the slot implementation

    I don't understand this, mind explaining it better?

  5. tarboss commented at 7:19 PM on April 30, 2020: none

    my stackoutput: Qt does not like the wallet_model->setParent(this) code.

    bitcoin-qt.exe!qt_message_fatal(QtMsgType formal, const QMessageLogContext & context, const QString & message) Zeile 1684 C++ bitcoin-qt.exe!QMessageLogger::fatal(const char * msg, ...) Zeile 796 C++ bitcoin-qt.exe!qt_assert_x(const char * where, const char * what, const char * file, int line) Zeile 3088 C++ bitcoin-qt.exe!QCoreApplicationPrivate::checkReceiverThread(QObject * receiver) Zeile 557 C++ bitcoin-qt.exe!QApplication::notify(QObject * receiver, QEvent * e) Zeile 2959 C++ bitcoin-qt.exe!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Zeile 1024 C++ bitcoin-qt.exe!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Zeile 233 C++ bitcoin-qt.exe!QObjectPrivate::setParent_helper(QObject * o) Zeile 2036 C++ bitcoin-qt.exe!QObject::setParent(QObject * parent) Zeile 1981 C++ bitcoin-qt.exe!WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wallet,std::default_deleteinterfaces::Wallet > wallet) Zeile 118 C++ bitcoin-qt.exe!WalletController::{ctor}::__l2::<Lambda>(std::unique_ptr<interfaces::Wallet,std::default_deleteinterfaces::Wallet > wallet) Zeile 42 C++ [Externer Code] bitcoin-qt.exe!interfaces::anonymous-namespace'::NodeImpl::handleLoadWallet::__l2::<Lambda>(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > & wallet) Zeile 289 C++ [Externer Code] bitcoin-qt.exe!boost::detail::function::void_function_obj_invoker1<std::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)>,void,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>::invoke(boost::detail::function::function_buffer & function_obj_ptr, std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > & a0) Zeile 160 C++ bitcoin-qt.exe!boost::function1<void,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>::operator()(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > & a0) Zeile 770 C++ bitcoin-qt.exe!boost::signals2::detail::call_with_tuple_args<boost::signals2::detail::void_type>::m_invoke<boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)>,0,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>(boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> & func, boost::signals2::detail::unsigned_meta_array<0> __formal, const std::tuple<std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &> & args, void * __formal) Zeile 106 C++ bitcoin-qt.exe!boost::signals2::detail::call_with_tuple_args<boost::signals2::detail::void_type>::operator()<boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)>,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &,1>(boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> & func, const std::tuple<std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &> & args, boost::mpl::size_t<1> __formal) Zeile 90 C++ bitcoin-qt.exe!boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>::operator()<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > >(const boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > & connectionBody) Zeile 133 C++ bitcoin-qt.exe!boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>,std::_List_iterator<std::_List_val<std::_List_simple_types<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > > > >,boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> >::dereference() Zeile 110 C++ bitcoin-qt.exe!boost::iterators::iterator_core_access::dereference<boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>,std::_List_iterator<std::_List_val<std::_List_simple_types<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > > > >,boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > >(const boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>,std::_List_iterator<std::_List_val<std::_List_simple_types<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > > > >,boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > & f) Zeile 551 C++ bitcoin-qt.exe!boost::iterators::detail::iterator_facade_base<boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>,std::_List_iterator<std::_List_val<std::_List_simple_types<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > > > >,boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> >,boost::signals2::detail::void_type,boost::iterators::single_pass_traversal_tag,boost::signals2::detail::void_type const &,__int64,0,0>::operator*() Zeile 657 C++ bitcoin-qt.exe!boost::signals2::optional_last_value<void>::operator()<boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>,std::_List_iterator<std::_List_val<std::_List_simple_types<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > > > >,boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > >(boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>,std::_List_iterator<std::_List_val<std::_List_simple_types<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > > > >,boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > first, boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>,std::_List_iterator<std::_List_val<std::_List_simple_types<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > > > >,boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > last) Zeile 57 C++ bitcoin-qt.exe!boost::signals2::detail::combiner_invoker<void>::operator()<boost::signals2::optional_last_value<void>,boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>,std::_List_iterator<std::_List_val<std::_List_simple_types<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > > > >,boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > >(boost::signals2::optional_last_value<void> & combiner, boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>,std::_List_iterator<std::_List_val<std::_List_simple_types<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > > > >,boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > first, boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::variadic_slot_invoker<boost::signals2::detail::void_type,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &>,std::_List_iterator<std::_List_val<std::_List_simple_types<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > > > >,boost::signals2::detail::connection_body<std::pair<enum boost::signals2::detail::slot_meta_group,boost::optional<int> >,boost::signals2::slot<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)> >,boost::signals2::mutex> > last) Zeile 64 C++ bitcoin-qt.exe!boost::signals2::detail::signal_impl<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::signals2::optional_last_value<void>,int,std::less<int>,boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)>,boost::function<void __cdecl(boost::signals2::connection const &,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)>,boost::signals2::mutex>::operator()(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > & <args_0>) Zeile 242 C++ bitcoin-qt.exe!boost::signals2::signal<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &),boost::signals2::optional_last_value<void>,int,std::less<int>,boost::function<void __cdecl(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)>,boost::function<void __cdecl(boost::signals2::connection const &,std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > &)>,boost::signals2::mutex>::operator()(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > & <args_0>) Zeile 723 C++ bitcoin-qt.exe!CClientUIInterface::LoadWallet(std::unique_ptr<interfaces::Wallet,std::default_delete<interfaces::Wallet> > & wallet) Zeile 51 C++ bitcoin-qt.exe!interfaces::anonymous namespace'::ChainImpl::loadWallet(std::unique_ptr<interfaces::Wallet,std::default_deleteinterfaces::Wallet > wallet) Zeile 342 C++ bitcoin-qt.exe!CWallet::CreateWalletFromFile(interfaces::Chain & chain, const WalletLocation & location, unsigned __int64 wallet_creation_flags) Zeile 4590 C++ bitcoin-qt.exe!LoadWallet(interfaces::Chain & chain, const WalletLocation & location, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & error, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & warning) Zeile 150 C++ bitcoin-qt.exe!LoadWallet(interfaces::Chain & chain, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & name, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & error, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & warning) Zeile 162 C++ bitcoin-qt.exe!interfaces::`anonymous namespace'::NodeImpl::loadWallet(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & name, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & error, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & warning) Zeile 262 C++ bitcoin-qt.exe!OpenWalletActivity::open::__l2::<Lambda>() Zeile 314 C++ bitcoin-qt.exe!QtPrivate::FunctorCall<QtPrivate::IndexesList<>,QtPrivate::List<>,void,void <Lambda>(void) >::call(OpenWalletActivity::open::__l2::void <Lambda>(void) & f, void * * arg) Zeile 130 C++ bitcoin-qt.exe!QtPrivate::Functor<void <Lambda>(void),0>::call<QtPrivate::List<>,void>(OpenWalletActivity::open::__l2::void <Lambda>(void) & f, void * __formal, void * * arg) Zeile 241 C++ bitcoin-qt.exe!QtPrivate::QFunctorSlotObject<void <Lambda>(void),0,QtPrivate::List<>,void>::impl(int which, QtPrivate::QSlotObjectBase * this_, QObject * r, void * * a, bool * ret) Zeile 174 C++ bitcoin-qt.exe!QtPrivate::QSlotObjectBase::call(QObject * r, void * * a) Zeile 101 C++ bitcoin-qt.exe!QSingleShotTimer::timerEvent(QTimerEvent * __formal) Zeile 320 C++ bitcoin-qt.exe!QObject::event(QEvent * e) Zeile 1229 C++ bitcoin-qt.exe!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Zeile 3722 C++ bitcoin-qt.exe!QApplication::notify(QObject * receiver, QEvent * e) Zeile 3094 C++ bitcoin-qt.exe!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Zeile 1024 C++ bitcoin-qt.exe!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Zeile 233 C++ bitcoin-qt.exe!QEventDispatcherWin32::event(QEvent * e) Zeile 1041 C++ bitcoin-qt.exe!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Zeile 3722 C++ bitcoin-qt.exe!QApplication::notify(QObject * receiver, QEvent * e) Zeile 3094 C++ bitcoin-qt.exe!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Zeile 1024 C++ bitcoin-qt.exe!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Zeile 233 C++ bitcoin-qt.exe!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Zeile 1699 C++ bitcoin-qt.exe!QEventDispatcherWin32::sendPostedEvents() Zeile 1064 C++ bitcoin-qt.exe!qt_internal_proc(HWND * hwnd, unsigned int message, unsigned __int64 wp, __int64 lp) Zeile 237 C++ [Externer Code] bitcoin-qt.exe!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Zeile 628 C++ bitcoin-qt.exe!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Zeile 135 C++ bitcoin-qt.exe!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Zeile 212 C++ bitcoin-qt.exe!QThread::exec() Zeile 515 C++ bitcoin-qt.exe!QThread::run() Zeile 583 C++ bitcoin-qt.exe!QThreadPrivate::start(void * arg) Zeile 380 C++ bitcoin-qt.exe!invoke_thread_procedure(unsigned int()(void *) procedure, void * const context) Zeile 92 C++ bitcoin-qt.exe!thread_start<unsigned int (__cdecl)(void * __ptr64)>(void * const parameter) Zeile 115 C++ [Externer Code]

  6. tarboss commented at 7:40 PM on April 30, 2020: none

    The assert fail happens when you open a second wallet, without closing the first one. That happens becoz QThread::currentThread() == thread() is not equal, and it goes the else branch, if u look in the code below:

    // Notify walletAdded signal on the GUI thread. if (QThread::currentThread() == thread()) { addWallet(wallet_model); } else { // Handler callback runs in a different thread so fix wallet model thread affinity. wallet_model->moveToThread(thread()); bool invoked = QMetaObject::invokeMethod(this, "addWallet", Qt::QueuedConnection, Q_ARG(WalletModel*, wallet_model)); assert(invoked); }

  7. hebasto commented at 3:27 AM on May 2, 2020: member

    @tarboss

    ... fires on my machine under visual studio 2017

    Is this condition required to observe the issue?

  8. tarboss commented at 9:16 AM on May 2, 2020: none

    yes (timerthread), just use debug builds in visula studio 2017 and qt 5.9.7 (downed from sipsorcery) to reproduce the assert. It happens if u open a second wallet (Multiwallet). The code above just fix the fatal assert. I use the code above in my private branch. Please check it out, if u can reproduce it. The release builds works fine, so its just informative. Did i get it right, "wallet_model->moveToThread(thread()); the wallet_model->setParent(this)" calls "steals" from the the timer thread the walletmodel to move it back to the guithread (wallet controller instance)? (my understanding)

  9. tarboss commented at 11:50 AM on May 2, 2020: none

    another thought: why not this code(short): (walletcontroller.cpp) OpenWalletActivity::open( ... QTimer::singleShot(0, lambda node.loadwallet(), controller-getorcreatewallet(), singleshot(finish)) ) i just refactor without the workerthread parameter(worker()) and the m_activity thread/worker setup less code - seems to work, or did i miss something? m_activity_worker(new QObject) only creates a worker object

    • need too further investigate, what the author has in mind.
  10. promag commented at 5:51 PM on May 3, 2020: member

    seems to work, or did i miss something?

    It works, but the UI hangs when loading the wallet.

  11. promag commented at 5:59 PM on May 3, 2020: member

    @tarboss what version/commit are you using/testing?

  12. tarboss commented at 6:18 AM on May 4, 2020: none

    Worker thread dont hurt, so i fixed only the setparent() call (rollback for wallentcontroller.cpp to branch 18 - (actually only copied the 3-4 lines + 1 function) ), where u set the setparent(this) call in the gui-main thread. This works nice even with debug builds. I use ubuntu 18 under windows 10 (slow - newest version, cross compile) and on windows 7 with native visual c++ compiler (nice too debug - review the code - checkout was in 2019 (sry a bit lazy, manual install of bitcoin on windows is a pain) but i reviewed the history of walletconroller & copied the newest version - should be the same on newest version

    update:

    • checked out today's master src - debug assert still exists in qt debug build!
    • tested setup (win7, qt5.9.7,vs2017, 2019 deps)
  13. promag commented at 1:37 AM on May 5, 2020: member
    • checked out today's master src - debug assert still exists in qt debug build!

    Can you share a stack trace with latest master?

  14. tarboss commented at 7:52 AM on May 5, 2020: none

    debug_assert_win10_vs2019debug2 debug_assert_win10_vs2019debug_stack2 debug_assert_win10_vs2019debug_stack_pstacks2

  15. hebasto commented at 8:54 AM on May 5, 2020: member

    @tarboss Mind testing #18883?

  16. tarboss commented at 5:58 PM on May 5, 2020: none
    • del QTimer::singleShot(0, this, &OpenWalletActivity::finish);
    • 311 + QMetaObject::invokeMethod(this, "finish", Qt::QueuedConnection);

    You fixed the debug assert (good job)

    but now i get:

    2020-05-05T16:59:36Z GUI: QMetaObject::invokeMethod: No such method OpenWalletActivity::finish() (debugconsole: logging enable only qt - need to figure out why he cant find the method - i compiled the mocfile again,too)

    and showProgressDialog does not close. U must click the close icon.

    (windows7 & visual 2017 & qt5.9.7) compiled new & tested debug build (windows10 & visual 2019 & qt5.9.8) compiler break & always compiles all files new (need to fix)

    my solution: remove this commit (if u want no assert on debug - worked for me) https://github.com/bitcoin/bitcoin/commit/6285a318d77dbfdf50f893963ebfb2973746f757#diff-dc8c2957962a3032071c55c70e120932

  17. hebasto commented at 11:15 PM on May 5, 2020: member
    * del QTimer::singleShot(0, this, &OpenWalletActivity::finish);
    
    * 311     + QMetaObject::invokeMethod(this, "finish", Qt::QueuedConnection);

    You fixed the debug assert (good job)

    but now i get:

    2020-05-05T16:59:36Z GUI: QMetaObject::invokeMethod: No such method OpenWalletActivity::finish() (debugconsole: logging enable only qt - need to figure out why he cant find the method - i compiled the mocfile again,too)

    and showProgressDialog does not close. U must click the close icon.

    Did you apply the whole a6b7248949670d15ca5b2f69b90aa69d38bfdc37 ? It contains changes in src/qt/walletcontroller.h as well:

    --- a/src/qt/walletcontroller.h
    +++ b/src/qt/walletcontroller.h
    @@ -145,7 +145,7 @@ public:
     Q_SIGNALS:
         void opened(WalletModel* wallet_model);
     
    -private:
    +public Q_SLOTS:
         void finish();
     };
     
    

    my solution: remove this commit (if u want no assert on debug - worked for me) 6285a31#diff-dc8c2957962a3032071c55c70e120932

    Let me look into it.

  18. tarboss commented at 7:41 AM on May 6, 2020: none

    thx, but assert still there. Checked only fast this morning.

    if u do
    wallet_model->setParent(this); (look the commit which u should remove) in the thread who created the walletcontroller (GuiMainThread) - it works.

    or if just do singleshot(0, lambda) without workerthread() - no assert - but it blocks (not good,too).

    On your systems u have no asserts - so i will close this issue this week - need too move on

    • thx anyway
  19. hebasto commented at 8:44 AM on May 6, 2020: member

    @sipsorcery as msvc connoisseur, mind looking into this and trying to reproduce?

  20. sipsorcery commented at 8:46 AM on May 6, 2020: member

    Sure, will take a look.

  21. sipsorcery commented at 9:52 AM on May 6, 2020: member

    I only got as far as attempting to create a wallet in bitcoin-qt before I got the assert.

    btcqt-debugassert-createwallet

    I'm building with Visual Studio 2019 Debug x64 on master but given where the assertion is occurring I don't think the Visual Studio version or platform will matter.

    The culprit in my case is in qt\walletcontroller.cpp line 114:

        wallet_model->moveToThread(thread());
        wallet_model->setParent(this);
        m_wallets.push_back(wallet_model); // <-- Assert occurs here.
    

    I'll apply #18883 and re-test.

  22. sipsorcery commented at 10:20 AM on May 6, 2020: member

    Seems to still exactly the same with #18883 applied.

    btcqt-debugassert-createwallet_18883

    Assert happens on line 114 in qt\walletcontroller.cpp.

    I know nothing about the internals of Qt but does the WalletModel object creation on line 112 somehow need to be done on the main UI thread as well?

  23. tarboss commented at 8:13 PM on May 9, 2020: none

    you dont obey this rule of QT: // Qt enforces the rule that events can only be sent to objects in // the current thread https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/kernel/qcoreapplication.cpp#n1085

    the setparent() call sends internal an QChildevent to the parent, but the parent object isnt owned by current thread (its from the gui mainthread).

    The qt-setparentcall() sets the parent before he sends the QChildevent message [QCoreApplication::SendEvent(parent, &e)] so u lucky and only the msg is f.. up! Enjoy the internals of QT!

    Remove the refactoring commit (scroll up) & you safe (no assert window).

  24. hebasto commented at 2:51 PM on May 11, 2020: member

    Steps to reproduce this issue on Linux Mint 19.3 (x86_64):

    $ make -C depends DEBUG=1
    $ CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site ./configure
    $ make
    $ QT_FATAL_WARNINGS=1 lldb src/qt/bitcoin-qt -- --regtest -debug=qt
    # load wallet via GUI
    bt
    * thread [#4](/bitcoin-bitcoin/4/), name = 'QThread', stop reason = signal SIGABRT
      * frame [#0](/bitcoin-bitcoin/0/): 0x00007ffff6397e97 libc.so.6`__GI_raise(sig=2) at raise.c:51
        frame [#1](/bitcoin-bitcoin/1/): 0x00007ffff6399801 libc.so.6`__GI_abort at abort.c:79
        frame [#2](/bitcoin-bitcoin/2/): 0x0000555556353006 bitcoin-qt`::qt_message_fatal((null)=<unavailable>, context=<unavailable>, message=<unavailable>) at qlogging.cpp:1690
        frame [#3](/bitcoin-bitcoin/3/): 0x0000555556353af1 bitcoin-qt`QMessageLogger::fatal(this=<unavailable>, msg=<unavailable>) const at qlogging.cpp:796
        frame [#4](/bitcoin-bitcoin/4/): 0x000055555634ec34 bitcoin-qt`qt_assert_x(where=<unavailable>, what=<unavailable>, file=<unavailable>, line=<unavailable>) at qglobal.cpp:3088
        frame [#5](/bitcoin-bitcoin/5/): 0x00005555564b57bf bitcoin-qt`QCoreApplicationPrivate::checkReceiverThread(receiver=0x0000555557918710) at qcoreapplication.cpp:557
        frame [#6](/bitcoin-bitcoin/6/): 0x00005555565ec0dd bitcoin-qt`QApplication::notify(this=0x00007fffffffd6a0, receiver=0x0000555557918710, e=0x00007fffaa7f90d0) at qapplication.cpp:2956
        frame [#7](/bitcoin-bitcoin/7/): 0x00005555564b5da1 bitcoin-qt`QCoreApplication::notifyInternal2(receiver=0x0000555557918710, event=0x00007fffaa7f90d0) at qcoreapplication.cpp:1024
        frame [#8](/bitcoin-bitcoin/8/): 0x00005555564f11fb bitcoin-qt`QObjectPrivate::setParent_helper(QObject*) [inlined] QCoreApplication::sendEvent(event=<unavailable>, receiver=<unavailable>) at qcoreapplication.h:233
        frame [#9](/bitcoin-bitcoin/9/): 0x00005555564f11e7 bitcoin-qt`QObjectPrivate::setParent_helper(this=0x00007fff9589b130, o=0x0000555557918710) at qobject.cpp:2036
        frame [#10](/bitcoin-bitcoin/10/): 0x00005555564f1ad5 bitcoin-qt`QObject::setParent(this=<unavailable>, parent=<unavailable>) at qobject.cpp:1980
        frame [#11](/bitcoin-bitcoin/11/): 0x000055555570871c bitcoin-qt`WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wallet, std::default_delete<interfaces::Wallet> >) + 1498
    ...
    

    @MarcoFalke Could remove "Windows" label?

  25. MarcoFalke removed the label Windows on May 11, 2020
  26. tarboss closed this on May 15, 2020

  27. hebasto commented at 4:07 AM on May 16, 2020: member

    The bug is reliably reproducible so I don't think closing this issue is the right way.

  28. MarcoFalke reopened this on May 16, 2020

  29. jonasschnelli closed this on Dec 2, 2020

  30. sidhujag referenced this in commit 49825c4526 on Dec 2, 2020
  31. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me