Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Pyside6.6.1 program crashed when QComboBox addItem() after clear()
Qt 6.11 is out! See what's new in the release blog

Pyside6.6.1 program crashed when QComboBox addItem() after clear()

Scheduled Pinned Locked Moved Solved Qt for Python
9 Posts 3 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Malvin LokM Offline
    Malvin LokM Offline
    Malvin Lok
    wrote on last edited by
    #1
    # init
    self.dbList = QComboBox(self.centralwidget)
    
    # use in
    self.ui.dbList.clear()
    db_count = get_dbs(r)
    print(f"db count:{db_count}")
    for db_idx in range(int(db_count)):
         key = f"db{db_idx}"
         db_key_count = 0
         if key in redis_info_list:
              db_key_count = redis_info_list[key]["keys"]
         self.ui.dbList.addItem(f"{key} ({db_key_count})", db_idx)
    

    full code:
    https://github.com/goodspb/reedis/blob/main/window/main_window.py#L145

    error:

    2024-01-13 17:03:38.386 python[28960:998356] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array'
    *** First throw call stack:
    (
    	0   CoreFoundation                      0x00000001a44cf0e4 __exceptionPreprocess + 176
    	1   libobjc.A.dylib                     0x00000001a3fedfd0 objc_exception_throw + 60
    	2   CoreFoundation                      0x00000001a45b99b4 -[__NSCFString characterAtIndex:].cold.1 + 0
    	3   CoreFoundation                      0x00000001a4442b28 -[__NSArrayM objectAtIndexedSubscript:] + 188
    	4   libqcocoa.dylib                     0x000000010bca6044 _ZN20QCocoaSystemTrayIcon13emitActivatedEv + 274796
    	5   libqcocoa.dylib                     0x000000010bca60c8 _ZN20QCocoaSystemTrayIcon13emitActivatedEv + 274928
    	6   libqcocoa.dylib                     0x000000010bca4688 _ZN20QCocoaSystemTrayIcon13emitActivatedEv + 268208
    	7   QtWidgets                           0x00000001048bd1a8 _ZN9QListView16selectionChangedERK14QItemSelectionS2_ + 204
    	8   QtCore                              0x000000010551348c _ZN11QMetaObject8activateEP7QObjectPKS_iPPv + 3808
    	9   QtCore                              0x00000001056d9e44 _ZN19QItemSelectionModel20emitSelectionChangedERK14QItemSelectionS2_ + 216
    	10  QtCore                              0x00000001056d9a2c _ZN19QItemSelectionModel6selectERK14QItemSelection6QFlagsINS_13SelectionFlagEE + 636
    	11  QtCore                              0x00000001056d970c _ZN19QItemSelectionModel6selectERK11QModelIndex6QFlagsINS_13SelectionFlagEE + 68
    	12  QtCore                              0x00000001056da8cc _ZN19QItemSelectionModel15setCurrentIndexERK11QModelIndex6QFlagsINS_13SelectionFlagEE + 260
    	13  QtWidgets                           0x000000010471b338 _ZNK9QComboBox5countEv + 828
    	14  QtWidgets                           0x000000010471e8b4 _ZN9QComboBoxC1ER16QComboBoxPrivateP7QWidget + 2412
    	15  QtCore                              0x0000000105513224 _ZN11QMetaObject8activateEP7QObjectPKS_iPPv + 3192
    	16  QtCore                              0x00000001056c2944 _ZN18QAbstractItemModel13endInsertRowsEv + 200
    	17  QtGui                               0x0000000109a677a4 _ZN18QStandardItemModel11itemChangedEP13QStandardItem + 2376
    	18  QtWidgets                           0x0000000104721910 _ZN9QComboBox10insertItemEiRK5QIconRK7QStringRK8QVariant + 368
    	19  QtWidgets.abi3.so                   0x00000001091153a8 _ZL25Sbk_QComboBoxFunc_addItemP7_objectS0_S0_ + 1032
    	20  python3.10                          0x00000001027c4b9c cfunction_call + 60
    	21  python3.10                          0x0000000102765f34 _PyObject_MakeTpCall + 336
    	22  python3.10                          0x000000010289b1c4 _PyEval_EvalFrameDefault + 155768
    	23  pydevd_frame_evaluator_darwin_310_6 0x0000000103f63500 __pyx_f_18_pydevd_frame_eval_36pydevd_frame_evaluator_darwin_310_64_get_bytecode_while_frame_eval + 4316
    	24  python3.10                          0x0000000102767548 _PyFunction_Vectorcall + 548
    	25  python3.10                          0x000000010276bcb4 method_vectorcall + 288
    	26  libpyside6.abi3.6.6.dylib           0x0000000103efe750 _ZN6PySide13SignalManager20callPythonMetaMethodERK11QMetaMethodPPvP7_objectb + 536
    	27  libpyside6.abi3.6.6.dylib           0x0000000103efe318 _ZN6PySide13SignalManager20SignalManagerPrivate16qtMethodMetacallEP7QObjectiPPv + 760
    	28  QtCore                              0x00000001055131f4 _ZN11QMetaObject8activateEP7QObjectPKS_iPPv + 3144
    	29  QtWidgets                           0x0000000104704ec8 _ZNK15QAbstractButton11isCheckableEv + 816
    	30  QtWidgets                           0x0000000104704d48 _ZNK15QAbstractButton11isCheckableEv + 432
    	31  QtWidgets                           0x0000000104705c48 _ZN15QAbstractButton17mouseReleaseEventEP11QMouseEvent + 172
    	32  QtWidgets                           0x00000001046518b8 _ZN7QWidget5eventEP6QEvent + 132
    	33  QtWidgets                           0x00000001047b2b24 _ZN11QPushButton5eventEP6QEvent + 204
    	34  QtWidgets                           0x0000000104608594 _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent + 272
    	35  QtWidgets                           0x000000010460a5c0 _ZN12QApplication6notifyEP7QObjectP6QEvent + 5072
    	36  QtCore                              0x00000001054c9474 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent + 292
    	37  QtWidgets                           0x0000000104608b34 _ZN19QApplicationPrivate14sendMouseEventEP7QWidgetP11QMouseEventS1_S1_PS1_R8QPointerIS0_Ebb + 808
    	38  QtWidgets                           0x0000000104666860 _ZNK21QWidgetRepaintManager3rhiEv + 11080
    	39  QtWidgets                           0x0000000104665a6c _ZNK21QWidgetRepaintManager3rhiEv + 7508
    	40  QtWidgets                           0x0000000104608594 _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent + 272
    	41  QtWidgets                           0x00000001046093e8 _ZN12QApplication6notifyEP7QObjectP6QEvent + 504
    	42  QtCore                              0x00000001054c9474 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent + 292
    	43  QtGui                               0x00000001097c39ec _ZN22QGuiApplicationPrivate17processMouseEventEPN29QWindowSystemInterfacePrivate10MouseEventE + 1740
    	44  QtGui                               0x000000010981f674 _ZN22QWindowSystemInterface22sendWindowSystemEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE + 408
    	45  libqcocoa.dylib                     0x000000010bc47d74 qt_plugin_instance + 58768
    	46  CoreFoundation                      0x00000001a44565ac __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
    	47  CoreFoundation                      0x00000001a4456540 __CFRunLoopDoSource0 + 176
    	48  CoreFoundation                      0x00000001a44562b0 __CFRunLoopDoSources0 + 244
    	49  CoreFoundation                      0x00000001a4454eb8 __CFRunLoopRun + 828
    	50  CoreFoundation                      0x00000001a4454428 CFRunLoopRunSpecific + 612
    	51  HIToolbox                           0x00000001adca8df0 RunCurrentEventLoopInMode + 292
    	52  HIToolbox                           0x00000001adca8a80 ReceiveNextEventCommon + 220
    	53  HIToolbox                           0x00000001adca8984 _BlockUntilNextEventMatchingListInModeWithFilter + 76
    	54  AppKit                              0x00000001a767c908 _DPSNextEvent + 636
    	55  AppKit                              0x00000001a767baa4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
    	56  AppKit                              0x00000001a766ff08 -[NSApplication run] + 464
    	57  libqcocoa.dylib                     0x000000010bc458fc qt_plugin_instance + 49432
    	58  QtCore                              0x00000001054d3160 _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE + 540
    	59  QtCore                              0x00000001054c9b00 _ZN16QCoreApplication4execEv + 112
    	60  QtWidgets.abi3.so                   0x00000001091d72d8 _ZL25Sbk_QApplicationFunc_execP7_object + 60
    	61  python3.10                          0x00000001027c57cc cfunction_vectorcall_NOARGS + 96
    	62  python3.10                          0x0000000102897c90 _PyEval_EvalFrameDefault + 142148
    	63  pydevd_frame_evaluator_darwin_310_6 0x0000000103f63500 __pyx_f_18_pydevd_frame_eval_36pydevd_frame_evaluator_darwin_310_64_get_bytecode_while_frame_eval + 4316
    	64  python3.10                          0x0000000102873444 _PyEval_Vector + 532
    	65  python3.10                          0x000000010286de8c builtin_exec + 308
    	66  python3.10                          0x00000001027c59a0 cfunction_vectorcall_FASTCALL + 88
    	67  python3.10                          0x000000010289e570 call_function + 1620
    	68  python3.10                          0x0000000102876fe8 _PyEval_EvalFrameDefault + 7836
    	69  pydevd_frame_evaluator_darwin_310_6 0x0000000103f63500 __pyx_f_18_pydevd_frame_eval_36pydevd_frame_evaluator_darwin_310_64_get_bytecode_while_frame_eval + 4316
    	70  python3.10                          0x0000000102767548 _PyFunction_Vectorcall + 548
    	71  python3.10                          0x000000010289ded8 PyObject_Vectorcall.4459 + 76
    	72  python3.10                          0x000000010289aa18 _PyEval_EvalFrameDefault + 153804
    	73  pydevd_frame_evaluator_darwin_310_6 0x0000000103f63500 __pyx_f_18_pydevd_frame_eval_36pydevd_frame_evaluator_darwin_310_64_get_bytecode_while_frame_eval + 4316
    	74  python3.10                          0x0000000102767548 _PyFunction_Vectorcall + 548
    	75  python3.10                          0x000000010289ded8 PyObject_Vectorcall.4459 + 76
    	76  python3.10                          0x0000000102898e30 _PyEval_EvalFrameDefault + 146660
    	77  python3.10                          0x0000000102767548 _PyFunction_Vectorcall + 548
    	78  python3.10                          0x000000010287d66c _PyEval_EvalFrameDefault + 34080
    	79  python3.10                          0x0000000102767548 _PyFunction_Vectorcall + 548
    	80  python3.10                          0x000000010289dfb0 call_function + 148
    	81  python3.10                          0x0000000102876fe8 _PyEval_EvalFrameDefault + 7836
    	82  python3.10                          0x0000000102873444 _PyEval_Vector + 532
    	83  python3.10                          0x00000001028ec518 run_mod + 220
    	84  python3.10                          0x00000001028ec2b8 pyrun_file + 156
    	85  python3.10                          0x00000001028ebd04 _PyRun_SimpleFileObject + 316
    	86  python3.10                          0x00000001028eb66c _PyRun_AnyFileObject + 216
    	87  python3.10                          0x000000010290fc14 pymain_run_file_obj + 196
    	88  python3.10                          0x000000010290f4a0 pymain_run_file + 72
    	89  python3.10                          0x000000010290eb40 pymain_run_python + 340
    	90  python3.10                          0x000000010290e994 Py_RunMain + 40
    	91  python3.10                          0x000000010270a650 main + 56
    	92  dyld                                0x00000001a401ff28 start + 2236
    )
    libc++abi: terminating due to uncaught exception of type NSException
    
    1 Reply Last reply
    0
    • Malvin LokM Offline
      Malvin LokM Offline
      Malvin Lok
      wrote on last edited by
      #2

      python: 3.10.13
      OS: macOS 13.6.3

      SGaistS 1 Reply Last reply
      0
      • Malvin LokM Malvin Lok

        python: 3.10.13
        OS: macOS 13.6.3

        SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Malvin-Lok Hi,

        Can you reduce your code so we can rule out interference from other dependencies ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        Malvin LokM 1 Reply Last reply
        0
        • F Offline
          F Offline
          friedemannkleint
          wrote on last edited by
          #4

          This sounds like https://bugreports.qt.io/browse/QTBUG-120469 ?

          Malvin LokM 1 Reply Last reply
          1
          • F friedemannkleint

            This sounds like https://bugreports.qt.io/browse/QTBUG-120469 ?

            Malvin LokM Offline
            Malvin LokM Offline
            Malvin Lok
            wrote on last edited by
            #5

            @friedemannkleint As I look at the question, yes, it's quite similar.

            1 Reply Last reply
            0
            • SGaistS SGaist

              @Malvin-Lok Hi,

              Can you reduce your code so we can rule out interference from other dependencies ?

              Malvin LokM Offline
              Malvin LokM Offline
              Malvin Lok
              wrote on last edited by
              #6

              @SGaist Thanks.

              I've created a sample project.

              https://github.com/goodspb/Pyside6Crash

              SGaistS 1 Reply Last reply
              0
              • Malvin LokM Malvin Lok

                @SGaist Thanks.

                I've created a sample project.

                https://github.com/goodspb/Pyside6Crash

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Malvin-Lok based on the bug report, it has been fixed for the next release.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                Malvin LokM 1 Reply Last reply
                0
                • SGaistS SGaist

                  @Malvin-Lok based on the bug report, it has been fixed for the next release.

                  Malvin LokM Offline
                  Malvin LokM Offline
                  Malvin Lok
                  wrote on last edited by
                  #8

                  @SGaist Cool, thanks. Let me try to update it to 6.6.2.

                  1 Reply Last reply
                  0
                  • Malvin LokM Offline
                    Malvin LokM Offline
                    Malvin Lok
                    wrote on last edited by
                    #9

                    Just checked on 6.6.2, and it's been fixed. Thanks

                    1 Reply Last reply
                    1
                    • Malvin LokM Malvin Lok has marked this topic as solved on

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved