Assertions with treectrl sample on OSX

44 views
Skip to first unread message

houchins

unread,
Sep 4, 2012, 4:20:16 PM9/4/12
to wx-u...@googlegroups.com
I am using widgets 2.9.4 on OSX, building with Cocoa.

When I run the treectrl sample, I get error assertions when it tries to create bitmap objects.  The bitmaps it tries to create are some 13x13 checkboxes, I think.  I have traced the problem to wxBitmapRefData::GetIconRef() in src/osx/core/bitmap.cpp line 586:

PicHandle pic = GetPictHandle() ;

The function GetPictHandle is not implemented, so returns a NULL handle value. That causes the following SetIconFamilyData call to not properly construct an icon object.

I found an old bitmap.cpp for Carbon posted on the net that implements a version of GetPictHandle. With some tweaking, my version seemed to work (at least quiet the assertions) and renders the checkbox images.  I have no idea if my fix is right.  If someone is interested, I can post it as a patch diff here.

Stefan Csomor

unread,
Sep 5, 2012, 1:55:15 AM9/5/12
to wx-u...@googlegroups.com
Hi
PICT is a QuickDraw Type which is not existing anymore on 64 bit at all, it has to be replaced 

Best,

Stefan

houchins

unread,
Sep 17, 2012, 12:54:50 PM9/17/12
to wx-u...@googlegroups.com
Hi

Does this mean a patch is imminent so that the assertion does not happen anymore?

Stefan Csomor

unread,
Sep 19, 2012, 10:01:48 AM9/19/12
to wx-u...@googlegroups.com
Hi

Does this mean a patch is imminent so that the assertion does not happen anymore?

please test with r72511

Thanks,

Stefan

houchins

unread,
Sep 19, 2012, 2:44:52 PM9/19/12
to wx-u...@googlegroups.com

Thanks for the patch.  But ... I am getting a compile error when integrating it:

../src/osx/core/bitmap.cpp: In member function ‘OpaqueIconRef* wxBitmapRefData::GetIconRef()’:
../src/osx/core/bitmap.cpp:464: error: ‘kIconServices1024PixelDataARGB’ was not declared in this scope

I found online that kIconServices1024PixelDataARGB is a new enum added for OS X 10.7 in CoreServices IconStorage.h, and it is in fact there on my system.

Ahhh ... we are building widgets using the  '.../SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6' setting because we intend our app to support 10.6.  Yes, I see, the 10.6 version of IconStorage.h does not have this enum value.  Seems like this could bite other developers, too.  Seems to me an #ifdef for 10.6 nees to be added to this patch around these lines of code.

Steve

houchins

unread,
Sep 19, 2012, 3:00:42 PM9/19/12
to wx-u...@googlegroups.com

I believe this will do it:

#if __MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_6

            case 1024:

                dataType = kIconServices1024PixelDataARGB ;

                break;

#endif

houchins

unread,
Sep 19, 2012, 3:15:01 PM9/19/12
to wx-u...@googlegroups.com

Now that it compiles for me taking 10.6 into account, I am still getting the same assertion.  When I step through bitmap.cpp, my system executes the code inside #ifndef __LP64__, which leads to executing these lines (about line 618)

PicHandle pic = GetPictHandle() ;

SetIconFamilyData( iconFamily, 'PICT' , (Handle) pic ) ;


and the call to GetPictHandle is the problem since it returns null.

The assertion happens just below at this line:

wxCHECK_MSG( err == noErr, NULL, wxT("Error when constructing icon ref") );


So, my system doesn't have __LP64__ defined.  OS X 10.7.4

Steve

Stefan Csomor

unread,
Sep 19, 2012, 3:24:28 PM9/19/12
to wx-u...@googlegroups.com


I believe this will do it:

#if __MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_6

            case 1024:

                dataType = kIconServices1024PixelDataARGB ;

                break;

#endif


yes, I've already added these lines in a subsequent patch

Thanks,

Stefan

Stefan Csomor

unread,
Sep 19, 2012, 3:28:02 PM9/19/12
to wx-u...@googlegroups.com
Hi
strange, I thought I still had the old QD code for 32 bit, generating PICTs, but it doesn't seem to be in there anymore, I'll check 

Thanks,

STefan 

Stefan Csomor

unread,
Sep 19, 2012, 5:17:27 PM9/19/12
to wx-u...@googlegroups.com
Hi

strange, I thought I still had the old QD code for 32 bit, generating PICTs, but it doesn't seem to be in there anymore, I'll check

I removed it when I removed 10.4 support, I'll complete the change

Thanks,

Stefan

houchins

unread,
Sep 24, 2012, 5:06:44 PM9/24/12
to wx-u...@googlegroups.com

I merged your Changeset 72515, which seems to be the removal of PICT you mention. There is still an issue with line 440 in bitmap.cpp:

     #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7

This does not compile when using the 10.6 SDK because MAC_OS_X_VERSION_10_7 isn't defined in 10.6.  The line needs to be

    #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6

OR your original #if needs to be fenced with #ifdef  MAC_OS_X_VERSION_10_7

With my change to this line, it builds fine and the treectrl sample no longer asserts.

Steve

Stefan Csomor

unread,
Sep 25, 2012, 9:06:07 AM9/25/12
to wx-u...@googlegroups.com
Hi

> #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
>
>This does not compile when using the 10.6 SDK because
>MAC_OS_X_VERSION_10_7 isn't defined in 10.6.

argh .. I forgot to update platform.h, I'm usually defining all systems
ahead, but didn't catch up ..

thanks for pointing this out,

Stefan

Reply all
Reply to author
Forward
0 new messages