Click here to Skip to main content
15,886,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to extract all words - using regular expression Pin
jschell30-Oct-23 5:23
jschell30-Oct-23 5:23 
AnswerRe: How to extract all words - using regular expression Pin
Salvatore Terress29-Oct-23 4:48
Salvatore Terress29-Oct-23 4:48 
Questioncalled pointer is null... Pin
Salvatore Terress24-Oct-23 6:50
Salvatore Terress24-Oct-23 6:50 
AnswerRe: called pointer is null... Pin
k505424-Oct-23 7:01
mvek505424-Oct-23 7:01 
AnswerRe: called pointer is null... Pin
Dave Kreskowiak24-Oct-23 7:10
mveDave Kreskowiak24-Oct-23 7:10 
GeneralMessage Closed Pin
24-Oct-23 8:15
Salvatore Terress24-Oct-23 8:15 
GeneralRe: called pointer is null... Pin
Dave Kreskowiak24-Oct-23 9:00
mveDave Kreskowiak24-Oct-23 9:00 
AnswerRe: called pointer is null... Pin
Richard MacCutchan24-Oct-23 22:12
mveRichard MacCutchan24-Oct-23 22:12 
The code, and the problem, is quite clear.
C++
  1  QTextEdit *textEditPtr_DEBUG = MWCCF->centralWidget()->findChild<QTextEdit *>("textEdit_2");
  2  if (textEditPtr_DEBUG)
  3  {
  4      text = " Found textEdit ";   OK here
  5      qDebug() << text;
  6      textEditPtr_DEBUG->append(text);
  7  
  8      text = " DEBUG START  DEBUG trace with textEdit_2" ;
  9      qDebug() << text;
 10      textEditPtr_DEBUG->append(text);
 11  }
 12  else
 13  {
 14      text = "Did not find any QTextEdit";
 15      qDebug() << text;
 16  }
 17  // ?? what why ??
 18  text = " DEBUG START  DEBUG trace with textEdit_2" ;
 19  textEditPtr_DEBUG->append(text);     crash -  null pointer here ??

At line 1 you (try to) create a pointer to some object.
At line 2 you test if that object is NULL, and if it is not, then you execute lines 4 to 10
If the object is NULL, then you skip to line 14
But then at line 19 you try to use a pointer which you may already have determined is NULL.

Unfortunately the debug output you have shown above does not match that code, so I am making some assumptions here.

[edit]
Also it does not help you to have the same debug message in two different places.
[/edit]

modified 25-Oct-23 5:13am.

GeneralRe: called pointer is null... Pin
CPallini24-Oct-23 22:38
mveCPallini24-Oct-23 22:38 
GeneralRe: called pointer is null... Pin
jschell25-Oct-23 4:44
jschell25-Oct-23 4:44 
GeneralRe: called pointer is null... Pin
Richard MacCutchan25-Oct-23 4:50
mveRichard MacCutchan25-Oct-23 4:50 
QuestionRegular expression error ? Pin
Salvatore Terress21-Oct-23 7:42
Salvatore Terress21-Oct-23 7:42 
AnswerRe: Regular expression error ? Pin
Richard Andrew x6421-Oct-23 7:50
professionalRichard Andrew x6421-Oct-23 7:50 
AnswerRe: Regular expression error ? Pin
Richard Andrew x6421-Oct-23 8:12
professionalRichard Andrew x6421-Oct-23 8:12 
GeneralRe: Regular expression error ? Pin
Salvatore Terress21-Oct-23 8:58
Salvatore Terress21-Oct-23 8:58 
AnswerRe: Regular expression error ? Pin
Salvatore Terress22-Oct-23 6:42
Salvatore Terress22-Oct-23 6:42 
GeneralRe: Regular expression error ? Pin
David Crow23-Oct-23 2:12
David Crow23-Oct-23 2:12 
GeneralRe: Regular expression error ? Pin
Salvatore Terress23-Oct-23 5:10
Salvatore Terress23-Oct-23 5:10 
GeneralRe: Regular expression error ? Pin
k505423-Oct-23 5:50
mvek505423-Oct-23 5:50 
GeneralRe: Regular expression error ? Pin
Salvatore Terress24-Oct-23 5:01
Salvatore Terress24-Oct-23 5:01 
GeneralRe: Regular expression error ? Pin
k505424-Oct-23 6:00
mvek505424-Oct-23 6:00 
GeneralRe: Regular expression error ? Pin
RedDk24-Oct-23 8:01
RedDk24-Oct-23 8:01 
AnswerRe: Regular expression error ? Pin
jschell23-Oct-23 5:16
jschell23-Oct-23 5:16 
QuestionHow to pass parameter (pointer) to function ? Pin
Salvatore Terress19-Oct-23 14:50
Salvatore Terress19-Oct-23 14:50 
AnswerRe: How to pass parameter (pointer) to function ? Pin
k505419-Oct-23 17:16
mvek505419-Oct-23 17:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.