Opened 6 years ago

Closed 6 years ago

#44258 closed defect (fixed)

kdelibs4: preventing a crash in the KWindowInfo::Private destructor

Reported by: RJVB (René Bertin) Owned by: NicosPavlov
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: mkae (Marko Käning)
Port: kdelibs4

Description

I came across a bug, as reported in my rekonq port submission: the snippet

             Q_FOREACH(const QWeakPointer<RekonqWindow> &pointer, wList)
             {
                 if (KWindowInfo(pointer.data()->effectiveWinId(), NET::WMDesktop, 0).isOnCurrentDesktop())
                     return pointer.data();
             }

will lead to calling CFRelease with a NULL argument in KWindowInfo::Private::~Private(). Cocoa allows sending a message (like release) to a nil object, but the CoreFoundation version CFRelease will crash when passed a NULL pointer. This is confirmed by the API documentation.

Attached is a very simple patch that adds the required check before calling CFRelease - as is done all other times that function is called.

Attachments (2)

avoid-kwindowinfo-destructor.patch (461 bytes) - added by RJVB (René Bertin) 6 years ago.
Portfile.diff (779 bytes) - added by RJVB (René Bertin) 6 years ago.

Download all attachments as: .zip

Change History (9)

Changed 6 years ago by RJVB (René Bertin)

comment:1 Changed 6 years ago by ryandesign (Ryan Schmidt)

Cc: nices@… removed
Keywords: haspatch added; crash NULL pointer CFRelease removed
Owner: changed from macports-tickets@… to nicos@…
Summary: preventing a crash in the KWindowInfo::Private destructorkdelibs4: preventing a crash in the KWindowInfo::Private destructor

You should also attach a patch for the portfile. The portfile's revision would need to be increased.

Changed 6 years ago by RJVB (René Bertin)

Attachment: Portfile.diff added

comment:2 Changed 6 years ago by NicosPavlov

I am currently trying to clean up the various patches of kdelibs4, so I will surely consider this one when committing. However, considering the type of issue, it should really be reported upstream.

comment:3 Changed 6 years ago by RJVB (René Bertin)

I am currently trying to clean up the various patches of kdelibs4, so I will surely consider this one when committing. However, considering the type of issue, it should really be reported upstream.

Has been done, but against 4.13.x because it's still there. Patching older versions is probably up to those still using them as I doubt we'll see a 4.12.6 release!

comment:4 Changed 6 years ago by NicosPavlov

In that case, providing the link to ease tracking could prove useful:

https://bugs.kde.org/show_bug.cgi?id=337154

comment:5 Changed 6 years ago by mkae (Marko Käning)

Cc: mk@… added
Version: 2.3.1

comment:6 Changed 6 years ago by mkae (Marko Käning)

BTW, on our KDE ticket wiki page we've listed this in section Issues at ​KDE's bug tracker as an existing ticket at b.k.o. (334827) which I have marked as a duplicate just now.

comment:7 Changed 6 years ago by NicosPavlov

Resolution: fixed
Status: newclosed

Committed in r122038. Thanks for the submission.

Note: See TracTickets for help on using tickets.