Professional Web Applications Themes

Strange compiler problem - Mac Programming

I am having a really weird problem. I am using PowerPlant and CW Pro 8.3 ( I have 9 bit I don't have the time to update to it yet) I have an app that has an assistant window that helps users do some specific tasks. This assistant window and different panes are all C++ based. Mainly off of PowerPlant classes. What is happening in one of the pane classes in the assistant window is that when I call my function to start the panel ( set up the panel correctly) it is jumping to a different class and different ...

  1. #1

    Default Strange compiler problem

    I am having a really weird problem. I am using PowerPlant and CW Pro 8.3 ( I
    have 9 bit I don't have the time to update to it yet)

    I have an app that has an assistant window that helps users do some specific
    tasks. This assistant window and different panes are all C++ based. Mainly
    off of PowerPlant classes. What is happening in one of the pane classes in
    the assistant window is that when I call my function to start the panel (
    set up the panel correctly) it is jumping to a different class and different
    method name within that class. Here is what I mean:

    void
    CXOBrowserCacheRemovalAssistantWindow::FinishCreat eSelf()
    {
    ....

    // now get the panel items
    mCurrentPanel = (CXOAssitantView*) (mMultiPanleView->GetCurrentPanel());
    ThrowIfNil_( mCurrentPanel );

    mCurrentPanelIndex = mMultiPanleView->GetCurrentIndex();

    mCurrentPanel->SetWindowObject( this );

    mCurrentPanel->StartPanel(); <----- code jumps to wrong place

    MoveWindowTo( kCXOAssistantWindow_HorizStartPos,
    kCXOAssistantWindow_VertStartPos);

    }

    So in the above code :

    mCurrentPanel->StartPanel();

    It should jump to my class CXOBrowserCacheRemovalSelectPanel and class
    method StartPanel():

    CXOBrowserCacheRemovalSelectPanel::StartPanel();

    Because that is the type that this panel is, but for some reason it is
    jumping to

    LPane*
    LPane::FindPaneByID(
    PaneIDT inPaneID)
    {
    return (inPaneID == mPaneID) ? this : nil;
    }


    And not too the method that it should. The class
    CXOBrowserCacheRemovalSelectPanel is based on LView which is based on LPane.
    Here is the class hierarchy for CXOBrowserCacheRemovalSelectPanel

    CXOBrowserCacheRemovalSelectPanel
    CXOBrowserCacheRemovalAssitantView
    CXOAssitantView
    LView
    LPane


    The really weird thing is that it works fine in several other assistant
    views that I have already. For the life of me I can not figure out why this
    is doing this. I have recompiled the whole program, I have even tried
    changing the name of this method just for this class and calling it directly
    but that still jumps to the wrong place.

    Has anyone else ever seen this? I have CW Pro 9, but have not ventured to
    use it yet, because I don't want a bunch of errors cropping up and having to
    fix compile errors right at the moment. But I guess I am going to have to
    give that a try. Does anyone else have any suggestions?

    Thanks,
    Scott Mitchell

    Scott Guest

  2. #2

    Default Re: Strange compiler problem

    In article <BC0C6BCE.237F%net>,
    Scott Mitchell <net> wrote:
     

    It looks to me as though the pointer you are getting back from
    GetCurrentPanel() is not in fact to a CXOAssitantView. Try replacing
    the C-style cast with a dynamic one:

    mCurrentPanel =
    dynamic_cast<CXOAssitantView*>(mMultiPanelView->GetCurrentPanel());

    It should then either work correctly or squeal at the ThrowIfNil_.
     

    There are no other "mix-in" bases? Multiple inheritance might cause a C
    cast to give you a pointer to the wrong part of the object, consistent
    with the symptoms you describe.

    Best wishes,
    Matthew Collett

    --
    Those who assert that the mathematical sciences have nothing to say
    about the good or the beautiful are mistaken. -- Aristotle

    Matthew Guest

  3. #3

    Default Re: Strange compiler problem

    Matthew Collett <ac.nz> wrote in message news:<ihug.co.nz>... 
    >
    > It looks to me as though the pointer you are getting back from
    > GetCurrentPanel() is not in fact to a CXOAssitantView. Try replacing
    > the C-style cast with a dynamic one:[/ref]

    Also, make sure you have all compiler inlining and optimizations turned off.
    Lally Guest

  4. #4

    Default Re: Strange compiler problem

    On 12/22/03 11:48 AM, in article
    ihug.co.nz, "Matthew Collett"
    <ac.nz> wrote:
     
    >
    > It looks to me as though the pointer you are getting back from
    > GetCurrentPanel() is not in fact to a CXOAssitantView. Try replacing
    > the C-style cast with a dynamic one:
    >
    > mCurrentPanel =
    > dynamic_cast<CXOAssitantView*>(mMultiPanelView->GetCurrentPanel());
    >
    > It should then either work correctly or squeal at the ThrowIfNil_.[/ref]

    Well you where right. The problem was somehow, my ClassID in my PPob, got
    messed up, and was completely wrong. So it was not even registering this
    Class. Once I fixed it, it worked fine. I should have checked that first.
    Sorry for the use of the bandwidth.

     
    >
    > There are no other "mix-in" bases? Multiple inheritance might cause a C
    > cast to give you a pointer to the wrong part of the object, consistent
    > with the symptoms you describe.
    >
    > Best wishes,
    > Matthew Collett[/ref]

    Thanks,
    Scott Mitchell

    Scott Guest

Similar Threads

  1. Compiler Problem
    By wruth in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: June 28th, 12:57 AM
  2. problem about compiler
    By Pagoda in forum PERL Beginners
    Replies: 3
    Last Post: April 13th, 06:39 PM
  3. Replies: 0
    Last Post: July 21st, 10:49 PM
  4. C compiler problem
    By Raghu in forum Sun Solaris
    Replies: 7
    Last Post: July 4th, 06:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139