Skip to content

Commit ac21361

Browse files
committed
Removed assert from stub's gui::Gui::get(). Check that the stub is not being
used before creating a gpl::GraphicsImpl object. Signed-off-by: Ted Hong <[email protected]>
1 parent d4a08a1 commit ac21361

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/gpl/src/MakeReplace.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#include "gpl/Replace.h"
77
#include "graphicsImpl.h"
8+
#include "graphicsNone.h"
9+
#include "gui/gui.h"
810
#include "tcl.h"
911
#include "utl/Logger.h"
1012
#include "utl/decode.h"
@@ -25,7 +27,11 @@ void initReplace(Tcl_Interp* tcl_interp)
2527

2628
void initReplaceGraphics(Replace* replace, utl::Logger* log)
2729
{
28-
replace->setGraphicsInterface(gpl::GraphicsImpl(log));
30+
if (gui::Gui::get() == nullptr) {
31+
replace->setGraphicsInterface(gpl::GraphicsNone());
32+
} else {
33+
replace->setGraphicsInterface(gpl::GraphicsImpl(log));
34+
}
2935
}
3036

3137
} // namespace gpl

src/gpl/src/graphicsImpl.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ namespace gpl {
2727
GraphicsImpl::GraphicsImpl(utl::Logger* logger)
2828
: HeatMapDataSource(logger, "gpl", "gpl"), logger_(logger), mode_(Mbff)
2929
{
30-
if (gui::Gui::enabled()) {
31-
gui::Gui::get()->registerRenderer(this);
32-
}
30+
gui::Gui::get()->registerRenderer(this);
3331
}
3432

3533
GraphicsImpl::~GraphicsImpl() = default;

src/gui/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ cc_library(
3030
deps = [
3131
"//src/odb",
3232
"@boost.multi_array",
33-
"@com_google_absl//absl/log:check",
3433
"@tk_tcl//:tcl",
3534
],
3635
)

src/gui/src/stub.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <typeinfo>
1313
#include <vector>
1414

15-
#include "absl/log/check.h"
1615
#include "gui/gui.h"
1716
#include "odb/db.h"
1817
#include "odb/geom.h"
@@ -53,9 +52,6 @@ Gui::Gui() : continue_after_close_(false), logger_(nullptr), db_(nullptr)
5352

5453
Gui* gui::Gui::get()
5554
{
56-
CHECK(enabled())
57-
<< "Internal Error: gui::Gui::get() called when enabled() is false";
58-
5955
return nullptr;
6056
}
6157

0 commit comments

Comments
 (0)