I made a custom window widget which can have multiple tab like Google Chrome using QTabBar.
All works find when the QTabBar is not movable but when it's movable I get a crash sometimes but not all the time when I remove the tab during drag and drop action.
I got a crash in the paintEvent of QTabBar because the index of is out of range:
Qt6Cored.dll!qt_message_fatal(QtMsgType __formal, const QMessageLogContext & context, const QString & message) Line 1864
Qt6Cored.dll!QMessageLogger::fatal(const char * msg, ...) Line 890
Qt6Cored.dll!qt_assert_x(const char * where, const char * what, const char * file, int line) Line 3119
> Qt6Widgetsd.dll!QList<QTabBarPrivate::Tab *>::at(__int64 i) Line 373
Qt6Widgetsd.dll!QTabBar:aintEvent(QPaintEvent * __formal) Line 1881
Qt6Widgetsd.dll!QWidget::event(QEvent * event) Line 8783
Qt6Widgetsd.dll!QTabBar::event(QEvent * event) Line 1793
Looks like remove a tab during "mouseMoveEvent" is not safe.
Is there a way to make it safe?
The only solution I have for now is to make the QTabBar not movable making the tab to not be able to move...
It's not happening all the time but during a move of tab + going outside the tabbar making it to be removed of the current tabbar.