-1

予期しないクラッシュについて説明するのを手伝ってください!!! 私は持っています:

xh

class x: QObject
   struct
    {
        struct
        {
            struct
            {
                int state;
                double curstring;
                QTimer timer_scroll;
                QTimer timer_done;
            }color;
            struct
            {
                int state;
                double curstring;
                QTimer timer_scroll;
                QTimer timer_done;
            }mono;
        }S2L_NOTIFY;

....等

x.cpp

void x::draw(const int type, QString str, bool isNeedAnswer)
{
    if(type == 3)
    {
        //here is crash!
        if(bitmap.S2L_NOTIFY.mono.state == 3 &&  bitmap.S2L_NOTIFY.color.state == 3)
        {

if((bitmap.S2L_NOTIFY.mono.state == 3))-<ここでクラッシュしない

if((bitmap.S2L_NOTIFY.color.state == 3)) -<ここでクラッシュしない

どこが間違っているのか、コンパイラが間違っているのか教えてください。

4

1 に答える 1

1

問題は、条件にxが含まれているが、関数x::rndfunc()はクラスxのメンバー関数であるということです...変数ではありません。そのはず:

// "this" refers to the current instance of class x
if((this->y.z.f.nmb2 == NOTOK) && (this->y.z.f.nmb1 == NOTOK))

または単に:

// but the "this" isn't actually necessary
if((y.z.f.nmb2 == NOTOK) && (y.z.f.nmb1 == NOTOK))

(あなたが書いたように)。

編集:さて、元の質問にタイプミスがあったので、上記はもはや関係ありません。新しい答えは次のとおりです。

fメンバー変数nmb1はなく、のみnmb2です。

編集#2:より多くのタイプミス。私の新しい答え:

あなたがやろうとしていることは本当に厄介に見えます。しないでください。

于 2012-04-21T00:49:26.177 に答える