0

C++ Builder XE2 でプログラムを変更しています。このプログラムはまだ vcl を使用していませんが、owlnext を使用しています。複数の MDI 子フォームが含まれています。

そこで、ルーチンを使用してファイルをロードし、新しいウィンドウを開きます。

このルーチンではすべてが正常に動作します (デバッグモードで行ごとに何度もトレースしました) が、PumpWaitingMessages() // pumps any waiting messages, idleCount=0終了して再び終了TApplication::MessageLoop()し、次のループに入り、window.h の関数であるwhich を呼び出すIdleAction(idleCount++)と、プログラムがクラッシュします。MainWindow->IdleAction(idleCount)TWindow::IdleAction(idleCount)

IdleAction 内で、次win->IdleAction(idleCount)の例外で呼び出すと、最初のループでアプリケーションがクラッシュします。

First chance exception at $004E4CA4. Exception class $C0000005 with message 'access violation at 0x004e4ca4: read of address 0x0000002c'. Process Project2.exe (3772)

この関数は、Owlnext で次のように定義されています。

//
/// Called when no messages are waiting to be processed, IdleAction performs idle
/// processing as long as true is returned. idleCount specifies the number of times
/// idleAction has been called between messages.
///
/// Propagate idle action to all children if count==0, and to any children that
/// previously said they wanted more time.
//
bool
TWindow::IdleAction(long idleCount)
{
  bool wantMore = false;
  TWindow* win = GetFirstChild();
  if (win) {
    do {
      if (idleCount == 0 || win->IsFlagSet(wfPropagateIdle)) {
        if (win->IdleAction(idleCount)) {
          win->SetFlag(wfPropagateIdle);
          wantMore = true;
        }
        else {
          win->ClearFlag(wfPropagateIdle);
        }
      }
      win = win->Next();
    } while (win && win != GetFirstChild());
  }
  return wantMore;
}

私の推測では、ウィンドウには無効なハンドルが存在しますが、win-object は無効ではないようです... 0x0000002c のアドレスを含む変数も見つかりません。

タイトルと親は NULL で、Handle は 0x00000004 ですが、他の値は私には正当に思えます...奇妙なことは、cursormodule.name をチェックすると、それが教えてくれることですE2122 Function call terminated by unhandled exception 0xc0000005 at address 0x408b1a

では、なぜこのエラーが発生するのか、または正しく機能させるために何を実行または元に戻すことができるのかを誰かが知っていますか?

編集: win->next は、次のように定義されたフクロウ関数です。

//
/// Returns a pointer to the next sibling window in the window's sibling list.
inline TWindow* TWindow::Next()
{
  return SiblingList;
}

TWindowTWindow* SiblingList;のプライベートとして TWindow は次のように宣言されています: http://pastebin.com/TzTp4ZXh (クラスには非常に大きな宣言があるため、リンクをたどってください)

4

2 に答える 2

2

プロジェクト設定が正しく設定されているかどうかを確認できますか: 整数サイズの列挙型のオプションがあり、オンにする必要があります 構造のアラインメントは OWLNext と同じにする必要があります - デフォルトでは 8 バイトです。

また、CodeGuard を有効にしてビルドし、問題が報告されるかどうかを確認できますか?

ジョギー

于 2013-04-25T17:19:12.073 に答える