[MacPorts] #44258: preventing a crash in the KWindowInfo::Private destructor

MacPorts noreply at macports.org
Sun Jul 6 15:28:32 PDT 2014


#44258: preventing a crash in the KWindowInfo::Private destructor
--------------------------------------------+------------------------------
 Reporter:  rjvbertin@…                     |      Owner:  macports-
     Type:  defect                          |  tickets@…
 Priority:  Normal                          |     Status:  new
Component:  ports                           |  Milestone:
 Keywords:  crash, NULL pointer, CFRelease  |    Version:  2.3.1
                                            |       Port:  kdelibs4
--------------------------------------------+------------------------------
 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.

-- 
Ticket URL: <https://trac.macports.org/ticket/44258>
MacPorts <http://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list