hi,

Qt Code:
  1. PrimaryDefs.h
  2. ...
  3. class ArchiveLocUI;
  4. static ArchiveLocUI *MainWid;
  5. ...
  6.  
  7. ArchiveLocUI.cpp
  8.  
  9. #include <PrimaryDefs.h>
  10. ...
  11. MainWid = (ArchiveLocUI *) this;
  12. qDebug("ArchiveLocUI MainWid(%X) name is %s, of type %s",MainWid, MainWid->name(),MainWid->className());
  13. wtabFCALC = new minicalc(wpgFullCalc,"wtabFCALC");
  14. ...
  15.  
  16. minicalc.cpp
  17.  
  18. #include <ArchiveLocUI.h>
  19. ...
  20. qDebug("minicalc MainWid(%X)",MainWid);
  21. qDebug("minicalc MainWid name is %s",MainWid->name());
To copy to clipboard, switch view to plain text mode 

a quick look above shows 3 files, 1 header and 2 source. the header file defines a static variable MainWid of type ArchiveLocUI* and this is visible to the whole application. MainWid is initialized first thing in the constructor of ArchiveLocUI and the qDebug shows it has a value (e.g. 12Dff0). a little later in the constructor another widget is created, wtabFCALC of type minicalc* and so its constructor fires.

however, in the constructor of minicalc, MainWid is 0 as printed on line 20 and then the program naturally crashes on line 21. the question is why?? MainWid is global and static and initialized before this line. MainWid is not declared locally anywhere so there's no scope issue.

anyone know what's going on?? thanks!

lou