A tube-plug extracting apparatus has a clamping mechanism, movable frame, chucking mechanism, rotation mechanism, and vertical motion mechanism. The gas cell has a gas inlet hole for letting the target gas come inside and a gas discharge hole for discharging the target gas, and retains a target gas to be detected. A source electrode of that one of the n-type thin film transistor and the p-type thin film transistor that is subjected for a longer period of time to an off voltage, applied to the shared gate electrode, for turning that transistor off, is extended in such a manner as to overlap a channel formation region of the corresponding thin film transistor.