mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Catch all exceptions in onPaint functions, because otherwise we show a message box. Message boxes while in a paint handler lead to a crash on win32.
Made a CATCH_ALL_ERRORS macro containing the common catch statements. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1034 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -115,6 +115,7 @@ class PackageInfoPanel : public wxPanel {
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
void onPaint(wxPaintEvent&);
|
||||
void draw(DC&);
|
||||
};
|
||||
|
||||
PackageInfoPanel::PackageInfoPanel(Window* parent)
|
||||
@@ -128,6 +129,11 @@ void PackageInfoPanel::setPackage(const InstallablePackageP& package) {
|
||||
|
||||
void PackageInfoPanel::onPaint(wxPaintEvent&) {
|
||||
wxBufferedPaintDC dc(this);
|
||||
try {
|
||||
draw(dc);
|
||||
} CATCH_ALL_ERRORS(false); // don't show message boxes in onPaint!
|
||||
}
|
||||
void PackageInfoPanel::draw(DC& dc) {
|
||||
wxSize cs = GetClientSize();
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
|
||||
Reference in New Issue
Block a user