Fix crash when KTextEdit::Factory is not found

Review Request #100949 - Created March 26, 2011 and submitted

Robert Mathias Marmorstein
kdevelop, quanta
This patch fixes a crash which occurs when closing kdevelop or quanta after the "KTextEditor::Factory not found" error box is displayed.  The problem is a simple logic error caused by the fact that QApplicationCore::exit() does not immediately abort an application.  Instead, it causes event processing to cease, which indirectly terminates the application AFTER the function has returned to the main event loop.
Recompiled, ran quanta and kdevelop.  Error message dialog still comes up (as it should), but the program closes without crashing now.
Milian Wolff
Robert Mathias Marmorstein
Review request changed

Change Summary:

This explicitly exits when kate (or equivalent) is not found.  I personally think the original patch is cleaner (and safer) code, but this should do what you want.


Revision 2 (+1 -1)

Show changes

Robert Mathias Marmorstein
I should add that I tested the new patch and it also works.
Milian Wolff
looks good now, I prefferr it that way. but I wonder - return code -1? shouldn't it be an int between 1 and 255?
  1. The exit status actually gets bitwise anded with the octal value 377, so both -1 and 1 return non-zero.  The -1 exit status is a standard for some projects (linux kernel?  I forget), while an exit status of "1" is also often used in Unix.  Ordinarily it doesn't matter, but using either of the numeric values can cause portability issues.  The new standard is to use "EXIT_SUCCESS" and "EXIT_FAILURE" macros to be more portable, so I have changed the code to use "EXIT_FAILURE", tested (it works), and committed.
  2. please add 
    REVIEW: 100949
    or similar (on it's own line) to the commit message next time. that way the review request gets closed automatically and one sees what commit it was.