Skip to content

QTBUG-49907 Use QPersistentModelIndex for storing a model index#8

Merged
BadSingleton merged 1 commit intoadsk-contrib/vfx/5.6.1from
autodesk/vfx/5.6.1/maya/2018/update3
May 30, 2018
Merged

QTBUG-49907 Use QPersistentModelIndex for storing a model index#8
BadSingleton merged 1 commit intoadsk-contrib/vfx/5.6.1from
autodesk/vfx/5.6.1/maya/2018/update3

Conversation

@BadSingleton
Copy link
Collaborator

QModelIndex is not safe to be used to store an index as it is designed
to be discarded right after use as the index information can change.

Therefore a QPersistentModelIndex should be used instead to store the
index. Subsequently the m_index does not need to be updated whenever
the model changes anymore as this is already done for us.

QModelIndex is not safe to be used to store an index as it is designed
to be discarded right after use as the index information can change.

Therefore a QPersistentModelIndex should be used instead to store the
index. Subsequently the m_index does not need to be updated whenever
the model changes anymore as this is already done for us.
@BadSingleton
Copy link
Collaborator Author

This pull request adds a commit that was forgotten.

@BadSingleton BadSingleton merged commit dc3a76b into adsk-contrib/vfx/5.6.1 May 30, 2018
@BadSingleton
Copy link
Collaborator Author

Cherry-picked from here: https://codereview.qt-project.org/#/c/174620/

jcfromsiberia pushed a commit to boris-fx/qtbase that referenced this pull request May 17, 2019
We were interpreting bit autodesk-forks#8 as the oblique bit, but this is the
WWS-conformity bit. Bit autodesk-forks#10 is the oblique bit.

[ChangeLog][Windows] Fixed an issue where loading fonts from files or data
would sometimes mistakenly classify them as oblique.

Fixes: QTBUG-73660
Change-Id: Id9e5012d1b89d0bee0e966c5105657b38834e13a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
DominicJacksonBFX pushed a commit to boris-fx/qtbase that referenced this pull request May 17, 2023
We can't guarantee that the library didn't define Objective-C classes
that still have lingering references, resulting in warnings such as:

 Attempt to use unknown class 0x10e52e110.

And possibly crashes such as:

 thread autodesk-forks#1, queue = 'com.apple.main-thread'
    frame #0: 0x00007fff203829ee libsystem_kernel.dylib`__ulock_wait + 10
    frame autodesk-forks#1: 0x00007fff203fa0c5 libsystem_platform.dylib`_os_unfair_lock_lock_slow + 162
    frame autodesk-forks#2: 0x00007fff2026226b libobjc.A.dylib`unmap_image + 85
    frame autodesk-forks#3: 0x000000010001e11f dyld`dyld::removeImage(ImageLoader*) + 557
    frame autodesk-forks#4: 0x000000010002291d dyld`dyld::garbageCollectImages() + 956
    frame autodesk-forks#5: 0x000000010002e35d dyld`dlclose + 191
    frame autodesk-forks#6: 0x00007fff203cf1c9 libdyld.dylib`dlclose + 183
    frame autodesk-forks#7: 0x0000000103f9f2f1 libQt6Core_debug.6.dylib`QLibraryPrivate::unload_sys(this=0x000000011ba2c7d0) at qlibrary_unix.cpp:294:9
    frame autodesk-forks#8: 0x0000000103f93f3f libQt6Core_debug.6.dylib`QLibraryPrivate::unload(this=0x000000011ba2c7d0, flag=UnloadSys) at qlibrary.cpp:614:36
    frame autodesk-forks#9: 0x0000000103f971fb libQt6Core_debug.6.dylib`QLibraryStore::cleanup() at qlibrary.cpp:425:22
    frame autodesk-forks#10: 0x0000000103f970f9 libQt6Core_debug.6.dylib`qlibraryCleanup() at qlibrary.cpp:447:5
    frame autodesk-forks#11: 0x0000000103f970d1 libQt6Core_debug.6.dylib`(anonymous namespace)::qlibraryCleanup_dtor_class_::~qlibraryCleanup_dtor_class_(this=0x00000001041edd38) at qlibrary.cpp:449:1
    frame autodesk-forks#12: 0x0000000103f930f5 libQt6Core_debug.6.dylib`(anonymous namespace)::qlibraryCleanup_dtor_class_::~qlibraryCleanup_dtor_class_(this=0x00000001041edd38) at qlibrary.cpp:449:1
    frame autodesk-forks#13: 0x00007fff202e5d25 libsystem_c.dylib`__cxa_finalize_ranges + 316
    frame qt#14: 0x00007fff202e6010 libsystem_c.dylib`exit + 53
    frame qt#15: 0x00007fff203d1f44 libdyld.dylib`start + 8
    frame qt#16: 0x00007fff203d1f3d libdyld.dylib`start + 1

  thread autodesk-forks#5, queue = 'com.apple.root.user-interactive-qos', stop reason = signal SIGABRT
    frame #0: 0x00007fff203a356e libsystem_kernel.dylib`__abort_with_payload + 10
    frame autodesk-forks#1: 0x00007fff203a4fbd libsystem_kernel.dylib`abort_with_payload_wrapper_internal + 80
    frame autodesk-forks#2: 0x00007fff203a4f6d libsystem_kernel.dylib`abort_with_reason + 19
    frame autodesk-forks#3: 0x00007fff202749e3 libobjc.A.dylib`_objc_fatalv(unsigned long long, unsigned long long, char const*, __va_list_tag*) + 114
    frame autodesk-forks#4: 0x00007fff20274971 libobjc.A.dylib`_objc_fatal(char const*, ...) + 135
    frame autodesk-forks#5: 0x00007fff20255ccb libobjc.A.dylib`lookUpImpOrForward + 881
    frame autodesk-forks#6: 0x00007fff2025539b libobjc.A.dylib`_objc_msgSend_uncached + 75
    frame autodesk-forks#7: 0x00007fff22f368d6 AppKit`-[_NSWindowTransformAnimation setCurrentProgress:] + 42
    frame autodesk-forks#8: 0x00007fff22f37a8a AppKit`__55-[NSAnimation(NSInternal) _advanceTimeWithDisplayLink:]_block_invoke + 31
    frame autodesk-forks#9: 0x00007fff22d0774f AppKit`NSPerformVisuallyAtomicChange + 132
    frame autodesk-forks#10: 0x00007fff22f379dc AppKit`-[NSAnimation(NSInternal) _advanceTimeWithDisplayLink:] + 172
    frame autodesk-forks#11: 0x00007fff22e9a184 AppKit`-[NSScreenDisplayLink _fire] + 180
    frame autodesk-forks#12: 0x00007fff2362f0b4 AppKit`___NSRunLoopTimerCreateWithHandler_block_invoke + 34
    frame autodesk-forks#13: 0x00007fff204c6be9 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    frame qt#14: 0x00007fff204c66dd CoreFoundation`__CFRunLoopDoTimer + 927
    frame qt#15: 0x00007fff204c623a CoreFoundation`__CFRunLoopDoTimers + 307
    frame qt#16: 0x00007fff204ace13 CoreFoundation`__CFRunLoopRun + 1988
    frame qt#17: 0x00007fff204abf8c CoreFoundation`CFRunLoopRunSpecific + 563
    frame qt#18: 0x00007fff2123d607 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
    frame qt#19: 0x00007fff22f378f0 AppKit`-[NSAnimation(NSInternal) _runBlocking] + 453
    frame qt#20: 0x00007fff22f376ae AppKit`__42-[NSAnimation(NSInternal) _runInNewThread]_block_invoke + 97
    frame qt#21: 0x0000000104edb032 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame qt#22: 0x0000000104edc264 libdispatch.dylib`_dispatch_client_callout + 8
    frame qt#23: 0x0000000104ef04ac libdispatch.dylib`_dispatch_root_queue_drain + 828
    frame qt#24: 0x0000000104ef0d3f libdispatch.dylib`_dispatch_worker_thread2 + 127
    frame qt#25: 0x0000000104f7eac7 libsystem_pthread.dylib`_pthread_wqthread + 244
    frame qt#26: 0x0000000104f7dae3 libsystem_pthread.dylib`start_wqthread + 15

This has been e.g. observed when a QNSWindow isn't closed and released
at application quit as expected. Although that is a corner case that
shouldn't happen, the general case is still valid.

Fixes: QTBUG-96208
Change-Id: I6c9d220e6f5389707baf7ae983f3156e8e51c316
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b6200de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
MikkiWells pushed a commit to boris-fx/qtbase that referenced this pull request Sep 16, 2024
Says ASAN:

    Direct leak of 524 byte(s) in 1 object(s) allocated from:
    #0 0x7f708f0a67cf in __interceptor_malloc ../../../../gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    autodesk-forks#1 0x7f707d94bf9e in CRYPTO_malloc crypto/mem.c:196
    autodesk-forks#2 0x7f707d7bd248 in asn1_item_flags_i2d crypto/asn1/tasn_enc.c:65
    autodesk-forks#3 0x7f707d7bd1b7 in ASN1_item_i2d crypto/asn1/tasn_enc.c:45
    autodesk-forks#4 0x7f707d85b7be in i2d_DHparams crypto/dh/dh_asn1.c:54
    autodesk-forks#5 0x7f7075a82223 in q_i2d_DHparams(dh_st*, unsigned char**) qsslsocket_openssl_symbols.cpp:435
    autodesk-forks#6 0x7f7075a82223 in QTlsBackendOpenSSL::dhParametersFromPem(QByteArray const&, QByteArray*) const qssldiffiehellmanparameters_openssl.cpp:139
    autodesk-forks#7 0x7f708ca9b588 in QSslDiffieHellmanParametersPrivate::initFromPem(QByteArray const&) qssldiffiehellmanparameters.cpp:285
    autodesk-forks#8 0x7f708ca9b588 in QSslDiffieHellmanParameters::fromEncoded(QByteArray const&, QSsl::EncodingFormat) qssldiffiehellmanparameters.cpp:94
    autodesk-forks#9 0x55fd8a545ebe in tst_QSslDiffieHellmanParameters::constructionPEM() tst_qssldiffiehellmanparameters.cpp:98
    [...]

The pointer returned in the out-parameter of a i2d_DHparams() call is
supposed to be OPENSSL_free()ed by the user (this is not at all
obvious from the docs¹, but an SO answer² indicates that's how it
should be (as well as asan stopping from complaining with this
patch applied)).

¹ https://www.openssl.org/docs/man3.1/man3/i2d_DHparams.html
² https://stackoverflow.com/a/53563669.

Amends 2cf63c7.

[ChangeLog][QtNetwork][SSL] Fixed a memory leak in parsing of
PEM-encoded Diffie-Hellman parameters.

Change-Id: I9ed4a26c4676db1c0d54a1945a4fb5014ce568cd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 676087e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant