mirror of https://github.com/davisking/dlib.git
Added try/catch blocks to the constructors of GUI window objects.
--HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402521
This commit is contained in:
parent
e8f39c05f1
commit
e2c891f634
|
@ -171,7 +171,7 @@ int WINAPI WinMain (HINSTANCE, HINSTANCE, PSTR cmds, int)
|
|||
|
||||
main_window::
|
||||
main_window(
|
||||
) :
|
||||
) try :
|
||||
color_non_evidence(0,0,0),
|
||||
color_default_bg(255,255,255),
|
||||
color_evidence(100,200,100),
|
||||
|
@ -261,7 +261,7 @@ main_window(
|
|||
// to all arrange themselves correctly in our window.
|
||||
no_node_selected();
|
||||
on_window_resized();
|
||||
}
|
||||
} catch (...) { close_window(); } // make sure close_window() is called if something throws
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class win : public drawable_window
|
|||
*/
|
||||
public:
|
||||
win(
|
||||
) :
|
||||
) try :
|
||||
c(*this),
|
||||
b(*this),
|
||||
cb(*this,rectangle(100,100,200,200),0,0,255), // the color_box will be blue and 101 pixels wide and tall
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
|
||||
set_title("dlib gui example");
|
||||
show();
|
||||
}
|
||||
} catch (...) { close_window(); } // make sure close window is called if something throws
|
||||
|
||||
~win(
|
||||
)
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
template <typename image_type>
|
||||
win(
|
||||
const image_type& img
|
||||
) :
|
||||
) try :
|
||||
gui_img(*this)
|
||||
{
|
||||
// set the size of this window to match the size of the input image
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
// show this window on the screen
|
||||
show();
|
||||
}
|
||||
} catch (...) { close_window(); } // make sure close_window() is called if something throws
|
||||
|
||||
~win(
|
||||
)
|
||||
|
@ -76,7 +76,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
// Here we open the image file. Note that when you open a binary file with
|
||||
// the C++ ifstream you must suplly the ios::binary flag.
|
||||
// the C++ ifstream you must supply the ios::binary flag.
|
||||
ifstream fin(argv[1],ios::binary);
|
||||
if (!fin)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue